Demo: Character infront and behind objects

UtopianGamesUtopianGames Member Posts: 5,692
edited November -1 in Working with GS (Mac)


Had a play, could be useful for an rpg where you want your character to walk behind and in front of objects like rocks and trees etc.

This is not currently possible with GS as far as i know so some trickery is going off here.

Darren.

Comments

  • magic101himagic101hi Member Posts: 713
    you could just make separate layers ;)

    -Josh
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    magic101hi said:
    you could just make separate layers ;)

    -Josh

    It's not that simple AT ALL! Watch how the blue character appears to go around a tree. I have never seen that done with GS before!

    Nice!
  • BackUpAndDownBackUpAndDown Member Posts: 685
    Thats easy...
  • mza1979mmza1979m Member Posts: 27
    I may be wrong, but as magic101hi said, I don't see why you can't use layers to do this (unless that is what you did?). I haven't really tried it, but when I think about it, why can't we just put the "foreground" trees on layer 1, the character on layer 2 and the "background" trees on layer 3? Wouldn't that allow the character to automatically visually appear sandwiched between the 2 tree layers? Or is it simply the tree hitting that's tricky?
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    If you were to use layers, then have collides on the trees, the spots where the trees seem to overlap you wouldnt be able to get threw because your colliding with both. And spots that the path is over a tree, doing it with layers you wouldnt be able to move threw that because you would still be colliding with it even though its underneath. Def not a simple as you guys think.

    Nice job darren!
  • UtopianGamesUtopianGames Member Posts: 5,692
    It's not as simple as putting the trees in different layers i can assure you, have a go and see what happens:)

    Layer 1 tree

    Layer 2 character

    Layer 3 tree

    Now what happens when you walk in front of layer 1 & behind layer 3 trees? You can't walk in front of layer 1 tree because its on top of the character and you can't walk behind layer 3 tree because the character is on a higher layer.

    Seems like sciTunes and John get what is going on with the character being able to walk all the way round the trees and pass under and over them.

    Darren.
  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    Cant wait to see what you do with this! Just thinking about the possible games with that makes me excited :)
  • juzcookjuzcook Member Posts: 259
    very clever darren! ive been thinking about that one myself! :)
  • zplzpl Member Posts: 26
    hello.

    quite new gamesalad user here. i have been also looking possibility to have some simple z-depth implementation.

    one thing i found (and been myself testing) was this photics idea:
    http://gamesalad.com/forums/topic.php?id=8533

    i'm now thinking that how serious problem is this:
    "even when an actor is destroyed it doesn't clear the RAM"

    is there any possibilities to check RAM usage?
    what happens if you change the scene, does it clear memory?
  • UtopianGamesUtopianGames Member Posts: 5,692
    There's no spawning or destroying in this example, but your right spawn destroy is a bad idea atm imo.

    Darren.
  • hrsmediahrsmedia Member Posts: 522
    So any hints on how it is done?
  • PhoticsPhotics Member Posts: 4,172
    Interesting... this looks like the start of an isometric RPG.

    I think it's easy to create. Here's how I'm thinking I would do it. There are multiple actors for each tree. The top tree actor goes invisible based on the main actor's "Y" position, a duplicate image of the tree is on the ground. (The image could actually be added to the main background to reduce the number of actors.)

    The hero actor is in a layer between the top tree images and the bottom tree images. When The hero is below a top-tree actor, that actor goes invisible - alpha zero.

    Collisions could also occur based on the actor's "Y" position too.
  • zplzpl Member Posts: 26
    how about this:

    you have sliced the view to horisontal areas, every area (layer) has own hero actor (which is hidden from screen when not needed), you switch hidden hero actor to correct position (inside scene) when y value of visible hero actor triggers new z-depth (...and of course hide the not needed actor now).

    layers make z-depth kind of automatic, just make it to look like the hero actor's vertical movement continues smoothly althought actor actually changes.
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Very nice ... whose a clever boy then ;)
  • forkliftforklift Member Posts: 386
    This can be easily achieved with small collision boxes constrained on the 'feet' of the character and at 'base' of the trees.

    I would be interested to know if you accomplished this by some other means.
  • GamersRejoiceGamersRejoice Member Posts: 817
    forklift said:
    This can be easily achieved with small collision boxes constrained on the 'feet' of the character and at 'base' of the trees.

    I would be interested to know if you accomplished this by some other means.

    This was my guess as to what was going on here. Or at least how I would do it with my limited knowledge.
  • UtopianGamesUtopianGames Member Posts: 5,692
    Photics has got it spot on...well done.

    Yeah it's simple really but i was wondering how to fake it for a while now and had some time to try.

    Works really well.

    Darren.
  • RiffelRiffel Member Posts: 1,272
    Nice job, Im working in this ideia, my game using it project is running in parallel.
    Pinball Xmas use the layers solution.

    http://itunes.apple.com/us/app/pinball-xmas-hd/id407536738?mt=8

    Congrats for your stuff Darren!
    Im just pausing game dev now, back in 2011.
  • PhoticsPhotics Member Posts: 4,172
    utopiangames said:
    Photics has got it spot on...well done.

    Thanks... and you've shown some outstanding creativity. It's easy to create, but hard to figure out. I'm glad that I was able to figure it out. It was more fun that way — excellent thread!
  • zplzpl Member Posts: 26
    hehe, nice one.

    got just my version working too.
  • RondoRocketRondoRocket Member Posts: 411
    Very cool!
  • expired_012expired_012 Member Posts: 1,802
    I definitely see the complication in that, very nice work! I think I understand how this works, but I really think that GS should have a simpler way of doing this. This is very important for certain types of games
  • SnowSnow Member Posts: 124
    I know this post is a few days old, but I've been looking for this functionality in GS.

    I coded a Flash AS2 demo of a game once where I had multiple characters walking around the screen filled with props as well. To make sure that a character was appropriately behind or in front of other characters/props, I simply did this:

    this.swapDepths(_y);

    This would give the actor a depth number that was equal to it's y-axis number. So a character that was at y==201 would be in front of a character or prop that was at y==200 or lower. :). In my demo, not a single actor was ever destroyed or spawned, I would simply reset their locations if they got killed. The demo ran like butter. Now if only I could do this with GS.

    There is object sorting in GS, since you can spawn stuff on top of eachother, but I guess so far we don't have access to it. It would be insanely helpful if we did. GS coders, get on this.
  • UtopianGamesUtopianGames Member Posts: 5,692
    Yes coming from a gamemaker background this was also possible with a similar piece of code.

    This would be great to have in GS but for now i think this way is best because it requires no spawning.

    Darren.
  • SnowSnow Member Posts: 124
    Dumb question probably, but where is the no spawning example?

    EDIT:
    Nvm, lol, I reread some of the posts. I like how photics thinks. :)
  • SkyMapleSkyMaple Member Posts: 817
    Does anyone have a demo available?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    SkyMaple said:
    Does anyone have a demo available?

    No just read the thread it says how to do it.
  • SkyMapleSkyMaple Member Posts: 817
    tenrdrmer said:
    No just read the thread it says how to do it.

    Thanks. I can do it if the enemies aren't moving but if they are, im stuck.
Sign In or Register to comment.