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.

Spikes[Resolved]

Hello, RMXP.org.

I thought the classical spikes puzzle would be pretty good for the game, and it would kind-of fit with my storyline. But I can't figure out how to make them. I have the basic understanding, though. I can make the spike go up and down, but I can't make it check if the player is on top of it or not. Please help!

I only know one way on how to do this, and it is very time-comsuming.

The first, the spike is a parallel process, it waits, say, 50 frames. Then it would change to the graphic of it up. Of course it would go back later. But the only way I know how to check if the player is on top of it is if I turn on a switch after it changes graphic, and the switch activates another event. That event would use the player's X and Y to see where he is. However, for my map full of spikes, that would be about 20 conditional branches!

If someone knows a way on how to do this, that would be great! Or you could give me a script, but this wouldn't be the right forum.  :tongue: Please ask questions if I was too vague or anything.

Happy game making,
~speedolphins
 
I did something like this once.  Here's the easy way:

The spikes are two-page events.  Page one, say, is the spikes retracted, and you use that graphic.  And that's all it does-- just sit there and display the graphic.

Page two is the spikes all up and pointy.  These spikes are triggered by event touch, and inflict damage (or whatever) to the party. 

Page two is triggered by a switch.

The switch is handled by yet another event-- it waits, say, 200 frames, then flips the switch on, waits 200, and flips it off.

Ta da! 

Note, however, that if you have a serious maze of spikes, you are filling a room with tons of events, which can make your game very, very lagtastic.
 
Unka Josh":2ffnazyj said:
I did something like this once.  Here's the easy way:

The spikes are two-page events.  Page one, say, is the spikes retracted, and you use that graphic.  And that's all it does-- just sit there and display the graphic.

Page two is the spikes all up and pointy.  These spikes are triggered by event touch, and inflict damage (or whatever) to the party. 

Page two is triggered by a switch.

The switch is handled by yet another event-- it waits, say, 200 frames, then flips the switch on, waits 200, and flips it off.

Ta da! 

Note, however, that if you have a serious maze of spikes, you are filling a room with tons of events, which can make your game very, very lagtastic.

When I was read that I was literally banging my head against my desk afterward. I can't believe it was that simple.  :shock: I guess I was making it harder for myself, haha.

Thank you!
 
You're quite welcome.  I want to emphasize the lag problem, though-- I did a cool maze of three different sets of spikes on different timers, and then got so sick of the lag in actual play that I replaced it with a maze of rolling boulders.
 
NOTE: Unka Josh prettymuch already nailed the thing on the head for you, if you get lost just follow his method. Mine is basically exactly the same, with some move route and conditional branches thrown in. Mucho props to Unka Josh for already posting the important stuff.

Hmm... that does sound like a functional way of setting up a spike trap, but it won't give you fully animated spike traps. I'm not Spike Trap crazy, but I've got a good handful of inventive spike traps in my project, I'll tell you my methodous of executing a spike trap.

First of all, I start it out with one single event. On the first page, it's the normal spike trap graphic with the spikes concealed, like stated above. This page shall remain empty other than the graphic.

Now, on page 2, under the part labeled "Autonomous Movement", click the botton that says "Move Route..." (Also, it is important you set up a trigger Switch on this second page, that'll turn the trap on and off. More notes in the end of this post under "Final Notes".)

@> Turn Left
@> Turn Right
@> Turn Up
@> SE: '094-Attack06', 80, 100
@> Wait: 5 frame(s) 
@> Turn Right
@> Turn Left
@> Turn Down
@> Wait: 40 frame(s)

Take note that @> Wait: 40 frame(s) in the above example is strictly a 'timing' method in the way the trap executes. Now, lets say you want a set of spikes that alternate (ie one spike goes up, the other goes down), you'll be using a Wait command to execute that as well. In a second set of spikes, instead of putting "Wait: 40 frame(s)" at the end of the 'move route', you'll put a "Wait: 20 frame(s)" at the beginning and end of the 'move route', meaning the second set of spikes will trigger when the other ones go down.

Okay, now if I haven't lost you yet, you should still be on Page 2. Now in the actual eventing page, you're going to set up a simple conditional.

@> Conditional Branch: this event is facing up
  @> Screen Flash: (255, 0, 0, 255), @10
  @> Set Move Route: Player
           : $> Turn Left
           : $> Direction Fix ON
           : $> SE: '093-Attack05', 80, 100
           : $> Jump: +1, 0
           : $> Direction Fix OFF
  @> Change HP: Entire Party, -5
  @>
  Branch End
@> End

This last part I showed you basically hurts the player (actually, the entire party), and makes them jump back a single frame. You don't necessarily have to do it that way though, you can make it where the player 'transfers' to the start of the spike trap or the map or whatever you feel you want to do when they get struck by the spikes.

Final Notes
Okay now, remember how I told you to set a switch for the spike trap that turns it on and off? Well, there's a few reasons why, i.) if more than one page has the same and/or no 'triggers' or conditions, the last page that meets those conditions will be executed automatically. This spike trap should only be active when you're near/on it.

In this case you'll have to set a seperate non-spike event that checks if the player has crossed a certain point before the spike traps. This can be either a parallel process that checks X/Y/facing, or an even simpler Player Touch that checks facing...

So...


PLAYER TOUCH
@> Conditonal Branch: if player is facing left
  @> Switch: Spike Trap = ON
END
@> Conditonal Brach: if player is facing right
  @> Switch: Spike Trap = OFF
END

This way, the Spike Traps will only be activated if you're walking left towards them. Once you begin walking right (walking away) from the trap, it will be deactivated. Especially useful for big maps that have other things to emphasize other than just a spike trap.
 

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