Mikey's Adventure for Construct 2?

Discussion and feedback on Construct 2

Post » Mon Mar 19, 2012 12:48 pm

Didn't see your question about depth sorting.

In 2D games, depth sorting is a way of faking a third dimension by examining the relative Y positions of two objects to decide which one is supposed to be in front of the other. It is accomplished by moving one object to a layer above or below the first object's layer, or using z-order to move one object to the front or back of the layer.

Although it isn't called depth sorting, it is discussed in Part 2 of the tutorial on page 5 (starting with Families)

The problem:

[Quote]When you ran the game did you notice that Mikey always appears in front of the trees, rocks, and walls? This doesnt look right at all! [/Quote]

And the solution:

[Quote]This event says that if Mikey is overlapping the Terrain family from the north (offset 0,100) then put him behind any objects in the family. Else is a special system condition when applied here it means in any other circumstance send Mikey to the front. Try out the new and improved game! [/Quote]

Of course there is no Else in C2, so that isn't the exact logic I used to accomplish it.

Anyway, you can see the depth sorting happen in the demo if you try to walk behind and in front of the trees. When Mikey's "feet" are higher than the tree's "feet", Mikey is considered to be behind the tree, he needs to be moved to the back of the z-order. If Mikey's feet are in front of the trees feet, Mikey is considered to be in front of the tree, he needs to be moved to the front of the z-order. Notice as you pass beside the tree the moment when the switch is made. In the case of a tree it looks pretty good - sort of like Mikey is brushing aside the branches in his way. (If the object is solid, like a wall, it doesn't look quite so good, so you have to use solids cleverly to keep the player from getting too close.)

For a maze game, as the player moves through the maze the depth sorting is really important to make the character appear in front of or behind the maze walls (like the castle walls and the house in the demo.)

Don't worry. It is much simpler than it seems when you first learn you have to do it! Took me awhile to grasp what was going on.

EDIT: One of the reasons I wondered about making this work for the free version of C2 is that it is really easy to deal with depth sorting if you have LOTS of layers to work with. But I managed to do all that is needed with 4 layers.kittiewan2012-03-19 12:56:17
B
29
S
11
G
12
Posts: 281
Reputation: 11,868

Post » Mon Mar 19, 2012 11:18 pm

[QUOTE=kittiewan] Didn't see your question about depth sorting.

In 2D games, depth sorting is a way of faking a third dimension by examining the relative Y positions of two objects to decide which one is supposed to be in front of the other. It is accomplished by moving one object to a layer above or below the first object's layer, or using z-order to move one object to the front or back of the layer.

Although it isn't called depth sorting, it is discussed in Part 2 of the tutorial on page 5 (starting with Families)

The problem:

[Quote]When you ran the game did you notice that Mikey always appears in front of the trees, rocks, and walls? This doesnt look right at all! [/Quote]

And the solution:

[Quote]This event says that if Mikey is overlapping the Terrain family from the north (offset 0,100) then put him behind any objects in the family. Else is a special system condition when applied here it means in any other circumstance send Mikey to the front. Try out the new and improved game! [/Quote]

Of course there is no Else in C2, so that isn't the exact logic I used to accomplish it.

Anyway, you can see the depth sorting happen in the demo if you try to walk behind and in front of the trees. When Mikey's "feet" are higher than the tree's "feet", Mikey is considered to be behind the tree, he needs to be moved to the back of the z-order. If Mikey's feet are in front of the trees feet, Mikey is considered to be in front of the tree, he needs to be moved to the front of the z-order. Notice as you pass beside the tree the moment when the switch is made. In the case of a tree it looks pretty good - sort of like Mikey is brushing aside the branches in his way. (If the object is solid, like a wall, it doesn't look quite so good, so you have to use solids cleverly to keep the player from getting too close.)

For a maze game, as the player moves through the maze the depth sorting is really important to make the character appear in front of or behind the maze walls (like the castle walls and the house in the demo.)

Don't worry. It is much simpler than it seems when you first learn you have to do it! Took me awhile to grasp what was going on.

EDIT: One of the reasons I wondered about making this work for the free version of C2 is that it is really easy to deal with depth sorting if you have LOTS of layers to work with. But I managed to do all that is needed with 4 layers.[/QUOTE]

Thanks for explaining about depth sorting. The last time I wrote a complete game was in the 8-bit era and layers weren't even part of Photoshop (and maybe Photoshop didn't even exist). Very cool and makes me excited even more about Construct.

4 layers is better than 25 when doing a tutorial. Simple is good when trying to understand things. And there is a certain value in having a tutorial be available for the free version of Construct 2 -- it can get people to see that Construct 2 is cool and they should buy it!
Check out my HTML5 Firefox OS Game Programming and Game Playing blog at http://firefoxosgaming.blogspot.com/ and my book on Amazon at http://www.amazon.com/dp/B00IZUYIGO. I wrote a newer post on using Construct for Firefox OS at http://firefoxosgaming.blogspot.com/201 ... -game.html.
B
16
S
4
G
4
Posts: 181
Reputation: 3,837

Post » Thu Mar 29, 2012 11:37 am

I've been trying to work through the tutorial as well and have hit a major road block with the last section of the second pdf, the hash tables. Everything else has been transferable to C2 pretty easily (I skipped families, text based input, and mouse click buttons.) I tried downloading the hash table plugins, and have been reading up on hash tables and arrays/loops, but I am in the dark. How did you pull set up the hash tag segment with the key and door. I tried to do it with arrays, but I am shooting in the dark lol.
B
9
Posts: 59
Reputation: 997

Post » Thu Mar 29, 2012 2:04 pm

I'm using an array instead of a hash table, but the easiest thing for you to do right now is just use a boolean instance variable.



Edit: Still haven't heard from scidave...kittiewan2012-03-29 14:07:22
B
29
S
11
G
12
Posts: 281
Reputation: 11,868

Post » Thu Mar 29, 2012 9:10 pm

I see, that's cool man thank you! I was hoping to use array/hash tables for an inventory system in my project, so while this will be useful with a lot of things, I can't wait to see the Array example, hopefully scidave OK's it! I played the demo you made, and it's a lot cooler then what I have going lol!
B
9
Posts: 59
Reputation: 997

Post » Wed Apr 11, 2012 3:49 pm

still haven't heard from scidave. For those of you who are interested, here is a link to the "ported" part 2.
Mikey

MikeysAdventure_pt2_noInventory

I'm holding off on the other parts because I want to use the new array features in C2 release 85, and haven't had a chance to play with them yet. They should make it much easier to manage the inventory array.

B
29
S
11
G
12
Posts: 281
Reputation: 11,868

Post » Thu Apr 12, 2012 9:53 pm

How is depth sorting handled? At the moment there are only two options Send to Top, and Send to Bottom - been driving me a little crazy. :P
Image
B
27
S
9
G
5
Posts: 487
Reputation: 11,939

Post » Thu Sep 20, 2012 5:40 am

I'm scidave and I approve this tut. :-)   Sorry, for the terrible long delay. I was without internet access for awhile and finally back into looking at Construct stuff.

I think it is awesome you are working on porting it to C2!
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: totoe and 7 guests