Actor moving, turning then shooting (then repeat)

prismprism Member Posts: 3
edited August 2012 in Working with GS (Mac)
Hello,
I'm trying to figure out how to move an actor (enemy actor) to a random place on the screen then turn toward the player then shoot Please note that the player will be moving. I want this all to happen every few seconds. I have been unsuccessful lately because it always ended up turning while moving and just ended up turning out bad. If anyone has the solution to this that would be great! Thanks

Comments

  • HapiappsHapiapps Member Posts: 373
    Ok, thats not to hard. Depends on if its landscape or portrait for the random but assuming its landscape.:

    Every (add time here) secs
    In the enemy actor
    Move to X pos = random(0,480)
    Move to Y pos = random(0,320)
    rotate to position x game.mycharacterpositionx - make this attribute
    rotate to position y game.mycharacterpositiony - make this attribute


    Every .1 secs or use contrain
    In my character
    Change attribute game.mycharacterpositionx to self position x
    Change attribute game.mycharacterpositiony to self position y



  • prismprism Member Posts: 3
    Thank you so much
Sign In or Register to comment.