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

Joined
Jul 12, 2020
Messages
111
Reaction score
20
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

Global Moderators
Global Mod
Joined
Mar 2, 2012
Messages
40,740
Reaction score
14,002
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

Almost to the finish line!... or the starting... since it's just the demo. :kaomad2:

Having problems with enemy/monster designs. :kaosigh:
While we prepare the official trailer, enjoy this kind-of-second teaser! ^^
-Ele
New Episodes of RPG Shenanigans Uploaded to Youtube!

Episode 5 - Surprise Party!
Youtube Link:
Episode 6 - Killer Gin
Youtube Link:
Episode 7 - Gaia's Melody: Echoed Melodies
(Coming soon!)

Episode 8 - Clarent Saga: Tactics
(Coming soon!)

Episode 9 - Star Shift
(Coming soon!)
When the Map Generator throws in the assets in the most dumbest way possible - your path is blocked :D

Forum statistics

Threads
107,567
Messages
1,030,616
Members
139,671
Latest member
WDRS
Top