Snake Game?

Ken110Ken110 Member Posts: 2
edited November -1 in Working with GS (Mac)
How would you go about creating a snake type game in GS? You know, when there is a ball that automatically moves and replicates every time you run over another randomly positioned different colored ball. You have to change the direction of the growing snake so you can collect the random ball and so you don't hit a wall or bump into yourself.

Any help would be greatly appreciated.

Comments

  • AfterBurnettAfterBurnett Member Posts: 3,474
    Interesting! Funny how something that seems so simple would probably be pretty tough to pull off. I'm a noob myself but have a few ideas how it would be done but I'm guessing my way wouldn't be very processor friendly. LOL. Something to think about, though!
  • iDeveloperiDeveloper Member Posts: 441
    I would like to know how to do this also.
  • HachikoHachiko Member Posts: 330
    I think that for the spawn of the little bits of the tail, you can just use something like when headsnake collides with food change global attribute to "spawn".
    Now, in the tail bit:
    if game.spawn is true and if "self.readytospawn" attribute is true, bit of tail spawn another bit of tail to x,y coordinates from it, and change self.readytospawn to false.

    All the little bit spawn with that self attribute to true by default, in this case, and when they spawn another bit of the tail, they uncheck that attribute, so that only the last bit of the tail spawn.
    Thing is, I need to think more for the movement. Making the snake head moving in the four direction is easy, I don't know about the bit of tails that must follow him.
    Maybe, if when an arrow is pressed game.posX and game posY are changed with the x and y coordinates of the snake head and if you store in an attribute the key that was pressed, then you can make it so that when the little bits of the tails reach those coordinate, they change direction based on the key that was pressed.
  • HachikoHachiko Member Posts: 330
    On second thought, you could just store the Y or the X based on the direction that the snake was facing. Then you can use that coordinates X or Y to say to the bits that if their position X or Y is greater or less than the X or Y stored by the snake head, they change direction.
    This way, with the greater or less thing, it should always fire right.
    I'll try when I have time, and I'll make a template. If it works xD
  • FranzKellerFranzKeller Member Posts: 517
    It's easy if there are "tile grids" to make such a thing.
    Iwas thinking of requesting that, it's great for platormer backgrounds

    Yet the snake game is so played out, I got tired of it back in the 80s
    Make something else! Like a centipede type game. Now that's entertainment

    Could be a big challenge to write , NE one up to it?
  • RHRH Member Posts: 1,079
    With difficulty, BarkBarkCo (name change?) made this though http://gamesalad.com/game/play/55205 . Can't download it unfortunately.
  • Ken110Ken110 Member Posts: 2
    Hey thanks everyone for all your help and suggestions!

    As POLYGAMe said, it is funny how something that seems like it would be pretty simple ends up being a bit tougher than expected.

    FranzKeller, I appreciate your suggestion to make something else although I am fairly new to gamesalad, I've always liked the Snake game and thought this would be a good practice game to start with. I wanted to do something a little different than the usual template games that come with GS.

    RH, thank you for that link, that is pretty much what I'm trying to do.

    And finally, Hachiko, thank you very much! I'm pretty sure I have a basic idea now of how to go about this, I will try it out in gamesalad soon. Also, I am looking forward to that template, hopefully it will work.
Sign In or Register to comment.