Jumping slimes and collision

IFCATS

Villager
Member
Joined
Feb 3, 2020
Messages
14
Reaction score
5
First Language
Italian
Primarily Uses
RMMV
So in my game i have a switch that is triggered when an event touch the player, who loses a life and is knocked back.
It works (sort of) well but I have a problem with jumping enemies.

If a slime or whatever jump and it lands directly on the tile where the player actor is the switch is not triggered (switch is called in a event touch event). How can I solve this?

I was thinking about creating a loop that checks continuously on player coordinates and compare it with the coordinates of the enemy when it lands but I am not sure how to implement it. Maybe putting the loop that store the player coordinates as a separate parallel event and compare it in the enemy event after each jump. What do you think? It seems a bit convoluted and I am still quite new to rpgmaker so I want to avoid writing spaghetti code. Any tips/ ideas?
 

fizzly

Veteran
Veteran
Joined
Mar 23, 2012
Messages
519
Reaction score
331
First Language
Polish
Primarily Uses
RMMV
But what do you want to achieve by this? Enemy is jumping on you to attack you? "Event touch" doesnt work, because the event is on evvent, and the slime is "same as character" I think.
 

ImaginaryVillain

Creator of the greatest plugin ever!!!!!!
Veteran
Joined
Jun 22, 2019
Messages
364
Reaction score
1,033
First Language
Absurdism
Primarily Uses
RMMV
Set the event to parallel, then add an if statement checking for...
JavaScript:
Math.floor($gameMap.distance($gamePlayer.x, $gamePlayer.y, $gameMap.event(this._eventId).x, $gameMap.event(this._eventId).y)) === 0;
You can change the 0 to whatever distance you want to check for.
 

IFCATS

Villager
Member
Joined
Feb 3, 2020
Messages
14
Reaction score
5
First Language
Italian
Primarily Uses
RMMV
@fizzly, I am not sure what you mean. Anyway yes, the slime jumps around the map trying to hit you.

@ImaginaryVillain I'll give it a try!

Thanks for helping guys!
 

IFCATS

Villager
Member
Joined
Feb 3, 2020
Messages
14
Reaction score
5
First Language
Italian
Primarily Uses
RMMV
I could not get my head around the script so I ended up solving it like this. I'll post it here in case it could be useful for fellow javascript-impaired like me

slimechecker.PNG
slimetest is the name of the slime event jumping around to kill you.
The deleted lines are not relevant to the behaviour.
The yellow wait instead is really important to time the triggering of the hit switch with the animation and it should be adjusted accordingly.
The jumpcheck switch is turned on inside the custom route of the slime.

edit: you can have a single event checking for all the slimes, as long has each slime has its own coordinates
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Making it a rule that I don't do any world building for my new game before the actual gameplay is concrete and working. I have 16 years of lore to work with anyway.
Cheesy power metal makes everything better. No matter what you do, you'll feel heroic doing it.
Starting to really like the first of my madness areas. I think the eyes looking at them really helps to sell the place. :LZSexcite:
Made idle animation for character. It first had only three frames but looked too different from walking animation and I had to draw five more.
MV and VX Ace both have good qualities.

Forum statistics

Threads
95,694
Messages
931,076
Members
126,034
Latest member
SuperSuck64
Top