Weird title I know. Thanks for all your help lately folks, it's been great.
Anywho, here's what's happening:
I've got an enemy who is a giant fist, designed to chase the player around the map, and when the enemy event is on the same tile as the player, it flashes for a few frames and then jumps (0,0) to crush the player if they're still on that tile when the jump completes.
The event, however, as it currently is, seems to also kill the player if they are within 1 tile in any of the 4 directions. I was hoping to only make it kill them if they're in the exact same spot where the jump originated.
First off, here's the event page for the Fist enemy, as well as his custom move route. I prefer repeated "Move Toward Player" over the "Approach" type because it behaves better... for some reason when I previously had it set to "Approach", it would ONLY kill the player when they were a tile away, but not when they were in the correct space. Since I changed it to "Move Toward," it now includes the correct space.
The rest of this enemy's programming is in a common event, so that I can have more than one of them operating at a time and easily modify all of their behavior at once.
So here's the common event. The Script in the conditional branch at the top there checks whether the enemy is on the same tile as the player. (Variables 5 and 6 are constantly refreshed with the Player's X and Y location, respectively).
Here it is in full:
I'm also choosing not to load the enemy's X,Y into variables because again, I want to have more than one operating on a single map and that would lead to either a lot of crossover or a ton of reserved variables that would have to be specified per enemy and that's just way too potentially messy.
Anywho, once the location check is confirmed, the Move Route that you see first causes the Fist enemy to flash for a moment...
...then after the flashing animation, the Fist jumps in place.
It plays a sound effect on landing, and then I run my tracker event again just to make sure the player's location is as accurate as possible. (The Clinky Tracker common event just loads the player's X and Y into variables 5 and 6 as mentioned before. Normally it's refreshing all the time, but I figured a double check within this event couldn't hurt.)
After that, I run the exact same Conditional Branch script line again to check for whether the player is still on the tile that should kill them, since I want them to have the opportunity to run away once the flashing animation begins.
This time, if they ARE on the tile, I run a common event that kills the player by squashing.
(The Else field pictured will enact another common event for other purposes, such as crushing other events. I have not implemented this yet because I'm just trying to make it work as a hazard first.)
Anyway, that is what's SUPPOSED to happen. Instead, as I said before, it's killing the player not only on the RIGHT spot, but also one tile away in any direction.
Thanks for reading. Any thoughts?
Anywho, here's what's happening:
I've got an enemy who is a giant fist, designed to chase the player around the map, and when the enemy event is on the same tile as the player, it flashes for a few frames and then jumps (0,0) to crush the player if they're still on that tile when the jump completes.
The event, however, as it currently is, seems to also kill the player if they are within 1 tile in any of the 4 directions. I was hoping to only make it kill them if they're in the exact same spot where the jump originated.
First off, here's the event page for the Fist enemy, as well as his custom move route. I prefer repeated "Move Toward Player" over the "Approach" type because it behaves better... for some reason when I previously had it set to "Approach", it would ONLY kill the player when they were a tile away, but not when they were in the correct space. Since I changed it to "Move Toward," it now includes the correct space.
The rest of this enemy's programming is in a common event, so that I can have more than one of them operating at a time and easily modify all of their behavior at once.
So here's the common event. The Script in the conditional branch at the top there checks whether the enemy is on the same tile as the player. (Variables 5 and 6 are constantly refreshed with the Player's X and Y location, respectively).
Here it is in full:
($gameMap.event(this._eventId).x == $gameVariables.value(5)) && ($gameMap.event(this._eventId).y == $gameVariables.value(6));
I'm also choosing not to load the enemy's X,Y into variables because again, I want to have more than one operating on a single map and that would lead to either a lot of crossover or a ton of reserved variables that would have to be specified per enemy and that's just way too potentially messy.
Anywho, once the location check is confirmed, the Move Route that you see first causes the Fist enemy to flash for a moment...
...then after the flashing animation, the Fist jumps in place.
It plays a sound effect on landing, and then I run my tracker event again just to make sure the player's location is as accurate as possible. (The Clinky Tracker common event just loads the player's X and Y into variables 5 and 6 as mentioned before. Normally it's refreshing all the time, but I figured a double check within this event couldn't hurt.)
After that, I run the exact same Conditional Branch script line again to check for whether the player is still on the tile that should kill them, since I want them to have the opportunity to run away once the flashing animation begins.
This time, if they ARE on the tile, I run a common event that kills the player by squashing.
(The Else field pictured will enact another common event for other purposes, such as crushing other events. I have not implemented this yet because I'm just trying to make it work as a hazard first.)
Anyway, that is what's SUPPOSED to happen. Instead, as I said before, it's killing the player not only on the RIGHT spot, but also one tile away in any direction.
Thanks for reading. Any thoughts?