Help needed! How do I make my guy move around in a certain area? PLEASE READ

Hey

I am working on my second game and need some help. It is basically kind of the classic Snake game, where you move around in lines collecting stuff to grow. Well, I want something like that, but I don't know how to do it. The character has to be able to move up, down, right and left by swiping to each directions and he carries on going to that direction. I might've explained it badly. If you don't understand something, please tell me. I really need help!

Thanks

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    I think deepblueapps has a template like that.
  • alexconsincalexconsinc Member Posts: 54
    Can I have a link to the template or just its name?
  • pipepipe Member Posts: 54
    like back and forth or like in a certain square
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited May 2013
    you can create the rules/logic for swiping direction, by keeping track of a items position. When the screen is touched, have an actor (which would be invisible) jump to the touch x and y position, save its x and y position to a game attribute, then when the swipe is finished (touch released) save another x and y position for where it was left. Then use some rules to work out if the swipe was up, down, left or right.

    Once you know the direction of the swipe you can do the rules to tell you main actor ( snake?) to move in that direction using the move behavior (or similar).

    I had to work out the same sort of logic for my swipe around the room template. Once the swipe was detected the room would animate around. Allowing you to move to the left or right or look at the ceiling or the floor.

    You'll end up adding all sorts of extra rules, so the swipe only counts if it is over a certain length, or within a certain time..

    As for keeping your actor (snake) with in a certain box, you'd add rules that say if its y pos was equal to or higher than a number (i,e,) 1000 change direction... Same for x... or you could have it collide with objects and change its direction when it detects a collision (but I would go for the more accurate maths setup).


  • alexconsincalexconsinc Member Posts: 54
    Can you make a video tutorial please? Thanks
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Sorry not got the time at the moment.

    New baby, any few minutes spare time I get at the moment is either spent looking at this forum, working on a project, making tea or sleeping.
  • pipepipe Member Posts: 54
    why dont you use walls
  • alexconsincalexconsinc Member Posts: 54
    @StormyStudio.com It's OK. Thanks for explaining it.

    @pipe What do you mean by walls?
  • joshiwujoshiwu Member Posts: 207
    Anyone willing to explain the growth portion of this question?
  • joshiwujoshiwu Member Posts: 207
    Anyone willing to explain the growth portion of this question?
Sign In or Register to comment.