Can shapes overlap with sprites?
-
Hi!
I want one of my sprites to disappear under a shape drawn with drawShape(). Is that possible?
I tried experimenting with changing the sprite visual depth with setSpriteDepth(), but that seems to only affect its depth position relative to other sprites...I am grateful for any help!
-
I don’t know if this is what you want but...
you could pixel draw the shape and turn that image into a sprite and have the other sprite go behind it -
Its all about draw order
If you say
DrawSprites()
DrawShapes()Then all shapes will draw in front of sprites,
Likewise for shapes behind. However you can also do:DrawShapes()
DrawSprites()
DrawShape(ShapeName)This will end up drawing all the shapes, then your sprites, and then just the one shape again, placing it in front of everything else. However, you should always use the CreateShape functions and not straight drawshape, as Drawshape will ignore your camera and just use screen coordinates, making a heck of a lot more math for you.
-
Thanks a lot. I think Retrocade's answer is exactly what I needed!
However, I am a bit confused about this:
This will end up drawing all the shapes, then your sprites, and then just the one shape again, placing it in front of everything else. However, you should always use the CreateShape functions and not straight drawshape, as Drawshape will ignore your camera and just use screen coordinates, making a heck of a lot more math for you.
Don't you always have to do a CreateXXX() to get a handle before doing DrawShape()? How do you use "straight drawshape"? In which cases will my camera be ignored?
Thanks!
-
@vinicity
Oh right, I can see how thats confusing. The "Straight Drawshape" functions I was mentioning are just the square(), circle(), etc. functions.