pointing an object in the right angle

part12studiospart12studios Member Posts: 620
edited November -1 in Working with GS (Mac)
Hi there everyone,

So I've been making some good progress on a game i hope to release soon, but i've come to a problem that i think will require some advanced math that i'm still very noobish on with game salad..

what i'm looking to do is.. have touch event object (a footprint) that i spawn to face at a variable x coordinate across the top of the screen.. that x variable changes frequently..

what i tried to do is each time that X change happens, to stamp that as a "change attribute" and then whenever the foot print is spawned it references the last stamp and would point at that x coordinate..

but i can't seem to figure out how to calculate the right angle to spawn. Any tips, leads or advice would be super appreciated!

Thanks,
Caleb

Comments

  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    vectortoangle(self.position.x-game.target.x,self.position.y-game.target.y)

    vectortoangle will be found in the functions drop down on the expression editior
  • part12studiospart12studios Member Posts: 620
    awesome thanks! I will be doing some heavy lifting this weekend with my game. Thanks sooo much! :)
Sign In or Register to comment.