When i press button enemy moves, when i release the button enemy stops...

Frap1KFrap1K Member Posts: 10

Hi guys I'm new to gamesalad trying to make a new game and got stuck on one problem!

I have my "Player Actor" and the Enemy which are getting spawned from the "spawner Actor". After the enemy have spawned they are chasing the "Player Actor" but only when I hold the button move "left" or "right". If i release the button they will instant STOP.

Please help! Thanks.

Answers

  • ycanycan Member, PRO Posts: 207

    create a new attribute "isChasing"
    touch pressed -> isChasing True
    isChasing True -> Enemy Chases

  • Frap1KFrap1K Member Posts: 10

    Thanks for replying but I didn't really understand where i need to put the attribute in? Is it the game attribute if yes what type? or is it in the Actor section (conditions)? Could you please be more descriptive?

  • bjandthekatzbjandthekatz Orlando, FlMember Posts: 1,375

    Create a game boolean
    If attribute: isChasing is true
    - (Rule to chase)

  • Frap1KFrap1K Member Posts: 10
    edited June 2014

    So i need to create a "game attribute boolean" called:"is Chasing" and then create in the "enemy actor" rule called: "attribute" or "Change Attribute" there are many of them... .

    As i mentioned before as the "Spawner Actor" spawns the zombies, the zombies straight away follow me but it follows only then when i press the left button or right but as soon as i release the button they all stop!

    Could somebody please describe step by step for me how and what to do thanks for future helps :)

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    It sounds like you have a rule in your enemy actor that moves it if the mouse button is down. That's my guess, anyway. What is the exact rule condition you're using for that rule?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Frap1KFrap1K Member Posts: 10

    Okey, I fixed the problem I just had to add a timer to the "distance between" and "Move To" I think that is to update player position? now when i stop zombies running towards me, so yeah every thing is fine now, thanks anyway guys.

  • IVER IndustriesIVER Industries Member Posts: 29

    to make it easier, you could create two game integer atributes, one name "player x" and the other "player Y" now in your "player actor" create two "constrain attribute" rules that look like:

    contstrain: "game.player x" then for the "to" section navigate to game>Player actor>position>x. then make the exact same rule for y.

    what that does is constantly tells the game where your player is. Now in your zombies, in your move to rule, you could move them to "Game.player x" and "game.player y".

    if you do that right the zombies will always know where you are and it supposedly reduces the thinking your game will have to do which is far more efficient. Hope this helped :)

Sign In or Register to comment.