Canvas and Z order

For questions about using Classic.

Post » Fri Jan 28, 2011 5:17 am

I'm making a split screen game and I'm running into trouble with the canvas object. I want the 2 sprites (which are in the family object) to go behind the other if it's Y is higher, as you'd expect. However, I have no idea how to do this using the canvas object. I tried "For each 'Friendly' in order of 'Friendly.Y' Ascending" - "paste to canvas", but it would only paste one of the sprites and the other wouldn't even show up.

Here's my .cap: [url:32ffjxyp]http://www.mediafire.com/?c8mv38tb11qsszn[/url:32ffjxyp]

The events in question are in "Layout 1 events"
B
3
S
1
G
3
Posts: 105
Reputation: 1,312

Post » Fri Jan 28, 2011 7:28 am

Canvas is flat. The drawing order is important; the one you draw the last will be drawn over everything else.

Reorder the drawing order by the Z order, should do the trick.
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155

Post » Fri Jan 28, 2011 8:19 pm

Any way I can do that? Like I said, I tried "For each 'Friendly' in order of 'Friendly.Y' Ascending" - "paste to canvas" but it only pasted the lower most sprite.
B
3
S
1
G
3
Posts: 105
Reputation: 1,312

Post » Fri Jan 28, 2011 10:27 pm

Set it up like this (indented lines are sub-events):
[code:3bpuu9z6]+ System: Always (every tick)
-> Canvas: Clear to transparent
-> Canvas: Set position to object Player1 (image point 0)
+ System: For each Friendly ordered by Friendly.Y Ascending
-> Canvas: Paste Friendly into canvas
+ System: Always (every tick)
-> Canvas: Set position to 80, 120
[/code:3bpuu9z6]
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Sat Jan 29, 2011 3:57 am

Thanks so much, that did the trick. Awww I love this forum, you guys are so helpful :)
B
3
S
1
G
3
Posts: 105
Reputation: 1,312


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 9 guests