Charas-Project

Off-Topic => Really Old Stuff => Archive => General programming => Topic started by: aznmyst on June 17, 2004, 09:57:31 PM

Title: Mini Games Tutorial
Post by: aznmyst on June 17, 2004, 09:57:31 PM
Does anyone know how to program an event where the hero has to sneak behind an enemy, but if the enemy turns around and your hero is infront of him, you have start over again?
Title:
Post by: WarxePB on June 17, 2004, 10:04:13 PM
Hmm... Do this.

-Get the X coordinates of the hero and the guard.
-Subtract 3 or 4 from the hero's X coordinate.
-Check if the guard and the hero are facing up.
-Check if the hero's X coordinate is greater or equal to the guard's X coordinate.
-If it is, teleport the hero to the starting point.
-If it isn't, do nothing.

Make sure that the guard is Parallel Process.

And, it doesn't have to be Up, either. If you want to use different directions, then do this:

-Left: Get Y, subtract
-Right: Get Y, add
-Down: Get X, add

If you need more clarifacation, just ask.