Projectile collision problem, ideas needed

LostFonDrive

Veteran
Veteran
Joined
Feb 13, 2015
Messages
161
Reaction score
43
First Language
English
Primarily Uses
Hi guys,

In my project the player has access to an at-will projectile that can be fired forwards, and it travels in a straight line for a few steps and then disappears. It will be used in puzzles, initiating combat etc.

However I have a problem relating to collision. If the projectile is fired at a wall, it is stopped by the wall, which makes sense. But this also happens when fired at any other collision boundary, for example if you are standing next to a river and you fire the projectile, it will be stopped by the river which does not make sense, it should fly over the river.

I am struggling to think of a solution because I don't think you can selectively make an event go 'through' collision specifically for water or whatever but not for walls. I am stumped. Any ideas?
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,049
Reaction score
7,035
First Language
German
Primarily Uses
RMMV
the problem here is that the passability system of the engine is absolute, it does not make a difference as to the reason for the impassability.

The 'easiest' solution (which will still require a lot of work) is to use the terrain tags to determine the "height" of a tile to be checked by whatever causes the movement of the projectile.
It can be done both by eventing and javascript plugin depending on what exactly you want, but it is not something easy to program either way.
 

Bex

Veteran
Veteran
Joined
Aug 2, 2013
Messages
1,350
Reaction score
333
First Language
German
Primarily Uses
RMMV
You could make the Projectile pass through everything. But if it hits a certain Region, it is handled like it hits a target or it just disappears. That Region is painted on all Walls and obstacles which should not be passed by the Projectile.

1. Mark the "Through" Box in the Projectile Event.
An Event with Projectile Graphic, through box marked, move frequency: highest and speed to max?.
2. Paint Region 1 over all Walls and obstacles that should not be passed by the Projectile.
3. In the Event for the Hit detection we also add a conditional branch that checks the Region Id on the Coordinates: X = Projectile Map x and Y = Projectile Map y.
When the Projectile Moves a step, the mapcoordinates change before the Projectile visibly moves to the next Map Tile, so if we detect that the Projectile hits Region1, than we can deactivate the Projectile Eventpage and make it disappear. You could additionaly play an Animation where a Bullet wall splash happens. But lets start with the basics.
4. You need one parallel Event that is checking if the bullet hits a target or a Wall, this Event should only be active when a Projectile is active on the Map and aslong the Projectile is moving.
5. You need another Parallel Event that is checking if the Shoot Projectile Button got pressed, if yes, than it needs to set the projectile event infront of the player and turn it away from player and move 8 steps forward.

In theory that should be all, but Andar is right, this isn't easy.
 

Andar

Veteran
Veteran
Joined
Mar 5, 2013
Messages
30,049
Reaction score
7,035
First Language
German
Primarily Uses
RMMV
Paint Region 1 over all Walls and obstacles
That is why I suggested terrain tags instead of region ID. Because the terrain tag is defined in the tileset it automatically applies to all tiles of that tileset without the need to pain every map with region IDs.

The region ID would only be the better solution if you have cases where identical tiles are used in different circumstances requiring different passability.
 
  • Like
Reactions: Bex

LostFonDrive

Veteran
Veteran
Joined
Feb 13, 2015
Messages
161
Reaction score
43
First Language
English
Primarily Uses
Thanks for the responses, guys. I hadn't considered I could use terrain tags or Region ID for this.
 

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

Latest Threads

Latest Profile Posts

Let's purchase th... WAIT! Just in time ehehehe.
Excited with the idea of a new maker, but I imagine I'll probably be disappointed.
super disappointed there will be a new RPG Maker without the current one being "finished"(we all know it wont get any more updates)
That's cool there's a new version coming. But I can't leave MV now. I think I'm just starting to get the hang of it.

Forum statistics

Threads
98,143
Messages
949,673
Members
129,429
Latest member
daagmilk
Top