How do I make an event stop moving when it hits a wall?

Joined
Jul 12, 2020
Messages
96
Reaction score
18
First Language
English
Primarily Uses
RMMV
Here's the coding :3
Screen Shot 2020-12-01 at 7.29.56 PM.png
Screen Shot 2020-12-01 at 7.30.01 PM.png

Soooo with the way this coding is currently setup, the snowball will travel repeatedly in the direction the player pushes it towards. (It's a sliding snowball, and the player is immune to the sliding effect)

However, I ran into a previously unnoticed issue...

Whenever the snowball touches a wall, it's still "repeating" the pushed movements. I know this because you can push the snowball against a wall that the player can also push. When I pushed the moveable wall that was blocking the snowball, the snowball continued moving in that direction despite not being pushed.

I previously did not notice this, but just discovered it when play testing.

How do I get the ball to stop repeating the movements once it touches something? I can't seem to find a way around that.
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
You can actually simplify that whole thing (including the "only move if I can" to this):

Code:
If Script: this.character(0).canPass(this.character(0).x, this.character(0).y, $gamePlayer.direction())
  Set Movement Route: [This Event] Move Away from Player
  Wait 9 Frames
  Set Movement Route: [Player] One Step Foward
End
That is the snowball, saying "if I can move in the direction that the player is facing, then move away from the player, and make the player move as well". It works because in order to activate the event, the player will be facing in the direction the event needs to move, and will activate it from the opposite side.
 

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

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,085
Members
137,585
Latest member
Reversinator
Top