Hi,
I'm a little confused about canvas and some other thing.
1. Which one is true about canvas (where Pink is the canvas):
Say, I want to make a new Trapezoid every time user pressed direction (UP, LEFT, RIGHT, DOWN) - Assume the Trapezoid is a class, like Player class.
Is it (a) I only need one canvas, then use that one to draw the next trapezoid? or (b) I have to make canvas for each trapezoid with width and height prespective to width/height of the trapezoid, begin draw, then add(trapezoid) in the PlayState?
- If (a), does the Trapezoid controlable? If yes, then I have to update each point (since drawPoly uses vertices) and redraw, or just call the redraw method?
- If (b), does this canvas act as 'collision colider'?
2.Also, what's the different between makeGraphic() and drawRect() etc. ? Isnt drawRect() also 'make graphic' ?
3. Talking about collision collider,
If canvas doesn't act as collider, how to add the collider?
I'm confused, close to know nothing about this. Because many examples uses graphics (such as PNG) and haven't found a game or example that uses this drawxxx() method as its 'graphic'.
When you add the collider, which one is true? Where grey is collision collider.
Also, because there is method getMidPoint(). Look at the picture below.
Suppose I the graphic is a PNG (the arrow). By getMidPoint(), I can get the mid point of it (red). Say from the mid point, I can find the coordinate of each angels(Yellow).
Then, I wanted to add the collision colider unto the grey area only, instead of the whole arrow. Is it possible?
I'm sorry I asked too much - really!
Thank you!!