Video Tutorial

UtopianGamesUtopianGames Member Posts: 5,692
edited November -1 in Working with GS (Mac)
Had to make the collision area smaller for my new game so made an actor that spawns to the center and realised you don't have to make a lot of different attributes and actors.



Hope im correct as it seems to be working and will save you a lot of time and resources.

Darren.

Comments

  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    Very interesting! Any ideas how that is working?

    I'm thinking it has to do with the order in which the constrain and spawn operations happen within each frame.

    Each actors constrain and spawn operations occur with every frame, and they don't happen at the same time. So, if the application goes through and works out the code for baddie #1 first, it will constrain its XY to the game attributes, the spawn #1's collision actor at those coords and then move on to actor #2 repeating the same steps over again, reusing the game attributes...

    Very cool stuff!
  • quantumsheepquantumsheep Member Posts: 8,188
    Nice!

    I did notice something similar, but didn't 'trust' it enough! Maybe if someone YELLOW comes in and confirms how this works I'd be more at ease! ;)

    Thanks for the video and tip!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • UtopianGamesUtopianGames Member Posts: 5,692
    Yeah i'm not sure i trust it (although in tests it works every time) so was hoping you or TSB or Joe has input or like you say a yellow box would be nice.

    Would save us all a bit of time if it was safe.

    Darren.
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    I believe JGary made a tower defense game that used this method. Although it does work, there are sometimes some glitches that can get those constrains mismatched.
  • BarkBarkCoBarkBarkCo Member Posts: 1,400
    Sounds like "mismatch" wouldn't be much of a problem for you as you are using the same "class" collision actor. If you had multiple collision types that needed to function differently, you would just need to track another set of X/Y attributes for each type.

    Good find though!
  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    the mismatch is when bad when a fish teleports.
  • UtopianGamesUtopianGames Member Posts: 5,692
    Hi CodeMonkey,

    Thanks for the heads up.

    I have a spawner for Bad Fish and then Bad fish spawns the collision, when the collision actors Y is <-80 it destroys itself and when bad fish Y is < -100 that destroys (i needed to destroy collision actor before fish otherwise it would cause frame rate to drop maybe because it was sticking around if i destroyed bad fish 1st?).

    You can't destroy or warp a bad fish, if you catch one by mistake the game over screen overlays and fades in but the bad fish keeps going until it reaches <-100.

    Darren.
  • ORBZORBZ Member Posts: 1,304
    I suspect this works because of the zorder of the actors. In your spawn of EvilCollider I see you spawn it "in front of actor" I suspect that if you change that to any other value it will not work. The reason I suspect it works is because GameSalad is processing the actors in the scene graph from the back to front.

    Adding one extra bit of fun would be to tag the EvilCollider with the FishID that way you could cross talk between the actors. Things like when (self) EvilFish.ID == Game.EvilColliderID // do stuff

    I did something like this back in 0.7.2 with my first game Polexia, unfortunately after the 8.0 update there were so many bugs (unrelated to this tip) in my game that I shelved it. If you are curious you can download an old 0.7.2 version of the GS Safari Plugin and view Polexia in it.

    Good find Darren, I had forgotten about that :)
  • Rob2Rob2 Member Posts: 2,402
    back or front of actor seems to work but either of the layer settings and all spawns are on top of each other (probably:))
Sign In or Register to comment.