13
« on: October 19, 2011, 05:16:46 pm »
This is a bit long and complicated, but please read it. I could really use some help...
I have a code that detects the distance between the enemy and the player, finds out if the enemy is facing the player, and then (should) get the x,y coordinates that would be on an imaginary line drawn between the two actors. (the x,y coords would have x incrementing by 1 each turn around, and the y being slope multiplied by whatever x currently is. Each time x is incremented, the current x,y coordinates would be saved in a list)
However, I have a problem. The distance and slope are found out fine, but when the code gets to the part where the list of x,y coords is formed...nothing happens. At all.
I used a repeat until block that would end when the line has been "drawn" from the enemy to the player. In it, the coordinates are calculated. Every repetition, the attribute, "score" should be incremented by 1 every turn (I set the score to equal x). However, the score doesn't change, which leads me to believe the repeat until block isn't even repeating the first place.
To make sure the score was updating, I set the score to also be equal to the distance, as long as the repeat until block isn't activated. The score updates fine until the repeat until block is supposed to start, in which case the score simply stops updating all together until I restart the game.
Here's the code: