Changing Action On Collision

Post Reply
Golde
Posts: 8
Joined: Fri Dec 27, 2019 11:12 pm

Changing Action On Collision

Post by Golde » Sun Mar 29, 2020 11:59 pm

My goal is to place mines that will explode when monsters or the player collide with one. The mines are game objects that the player places onto the world. So far I've figured out that I probably need to code a new End Action setting that will loop the default animation until a collision occurs, which would trigger the next action step that would be an explosion. My problem is that I don't have much knowledge of Assembly language so I'm not sure where to start with this. I've spent the past couple of days looking for info that could help me figure this out but haven't gotten anywhere with it. Am I going about this the right way and if so how do I code this?
User avatar
dale_coop
Posts: 5215
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Changing Action On Collision

Post by dale_coop » Mon Mar 30, 2020 9:58 am

Check the Proximity script... set this action to Action Step 0.... loop. and it will change to Action Step 1, when the player is near.
http://www.nesmakers.com/viewtopic.php?f=40&t=1958

You could modify it to check against a monster, instead of the player.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
Golde
Posts: 8
Joined: Fri Dec 27, 2019 11:12 pm

Re: Changing Action On Collision

Post by Golde » Sat Apr 04, 2020 12:01 am

Thank you! This is definitely the kind of thing I'm looking for. Any idea how to narrow it down so it will only trigger when something is about right on top of the object? I've tried tinkering with the ENEMY_HPROXIMITY and ENEMY_VPROXIMITY constants, and the object either changes state immediately after it's placed or if the constants are smaller the state won't change no matter how close I get. I tried changing the bounding box too to see if that would effect anything and it doesn't really seem to have.
Golde
Posts: 8
Joined: Fri Dec 27, 2019 11:12 pm

Re: Changing Action On Collision

Post by Golde » Sat Apr 04, 2020 12:21 am

Image

No explosion when the constants are set to 4, instant explosion when they're set to 5.
Attachments
mineexplosion.gif
mineexplosion.gif (1.19 MiB) Viewed 359 times
minenoexplosion.gif
minenoexplosion.gif (1.2 MiB) Viewed 359 times
User avatar
dale_coop
Posts: 5215
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Changing Action On Collision

Post by dale_coop » Sun Apr 05, 2020 9:01 am

Which script do you use (in the topic, if you read every messages on the 1st page, chronicleroflegends shared several ones... but the last script, on "Wed Feb 06, 2019 9:42 pm" he edited, should be the correct one)
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
Golde
Posts: 8
Joined: Fri Dec 27, 2019 11:12 pm

Re: Changing Action On Collision

Post by Golde » Mon Apr 06, 2020 10:13 pm

This is using the most recent script with the lower section commented out for 4-way checking.
User avatar
dale_coop
Posts: 5215
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Changing Action On Collision

Post by dale_coop » Tue Apr 07, 2020 9:18 am

But it's normal, it's exploding... because when you drop it, you are close to it. If you made the value smaller, the calculations will work correctly.
The value should be around 16. But the script NEEDS to be modified if you want to make it explose with monsters and not the Player.

If your coding skills are limited, another (easier) way would be to just make them explode on a timer.
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
My son's game: KUBO 3
Post Reply