Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Creating Traps - Eventing Help

I need a little help making a spiked trap on the floor, but I'm not quite sure how to make it work.

How I would need it is as so: When the player steps on the trap, they have roughly two seconds to get off before the spikes come up. If the player is on the trap when the spikes come up, they get tossed back and receive damage before the spikes go back down. If they're off the trap, the spikes come up, and go back down without harming anything.

How would I go about doing that?
 
Easiest way is probably a two-page event. On the first page, have it check for Player Touch. Tell it to wait for 40 frames (which is 2 seconds), then turn self switch A on. Then, on page 2, with criteria "Self Switch [A] = ON", you'll handle the state where the spikes are exposed. Checking if the player is on top is easy; have four variables: two for "This Event X" and "This Event Y", two for "Player X" and "Player Y". If the Xs and the Ys are equal, you know there is a collision with the spikes and the player, and you can handle it appropriately. You can handle the knockback with a Move Event command for the player using the Direction Fix and Jump commands, and then adjust the health with an event command as well. Then, just set the self switch A back to off, and they're ready to be sprung again.
 

Untra

Sponsor

My suggestion would be to use multiple event pages and self switches.

Page 1
player touch
---
Play SE
Self Switch A

page 2
parallel process
A on
---
Wait: 40
Self Switch B

Page 3
parallel process
B on
---
VariableX == Player X
VariableY == Player Y
If Variable X == xx
Then
If variable Y == yy
then
Show animation
text
change HP
Self Switch A off
Self Switch B off

That should do it. Their might be something else I'm missing but that ought to be able to do so. Spike traps normally simple, but having a two second wait period is what seems to make yours unique.
 
Untravaersil;327712 said:
Page 3
parallel process
B on
---
VariableX == Player X
VariableY == Player Y
If Variable X == xx
Then
If variable Y == yy
then
Show animation
text
change HP
Self Switch A off
Self Switch B off

I really don't understand what you're doing in this part -- I'm horrible with conditional branches. Can you describe it better, or take a screenshot showing what you mean?
 

Untra

Sponsor

Atemu;327714 said:
I really don't understand what you're doing in this part -- I'm horrible with conditional branches. Can you describe it better, or take a screenshot showing what you mean?

Conditional branches are pretty essential to making a game. It might be best for you to take a tutorial on them. In the meantime, I used jumps to work it That, and I now realize it can be done with only two pages.
http://i134.photobucket.com/albums/q98/ ... /trapz.png[/IMG]

Replace the 8's in the conditional branch boxes with whatever the coordinates of the trap on the map.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top