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.

Need help with a puzzle in my game

uupa99

Member

What I would like is a puzzle (not really a puzzle but ya...) that you have to push an object on top of a button on the ground. Their will be 2 buttons. Once both are being pressed (when an object and/or you are on both buttons) a door will open. no one 1 button is being pressed, the door will not open. I'm not sure how else to describe it.

I have tried to event this myself, and in fact I think it works a bit. But the buttons on the ground are just not their o.o and I'm very confused.

Anyway, I would like some help. If their is a script or if someone can give me proper directions on how to event this, then PLEASE tell me!!!
 
It's very simple. I describe how it's done.

First, you need 2 switches, name them how you want. After that, make the event for a door. At the left side, on the top, are 2 switch fields. You want to put the 2 switches in there. If they are both true, the door will open.
Next comes the button bit, you make 2 button with event touch trigger. This means that if the event touches something, it will do something. In the event command window, you just put the switch on. If you made both switches on, the door will open.
After that, you make 2 boxes or something. There you put conditional branches in, if left is touched you the box moves left and so on. You can now touch the boxes on the buttons, the switches get on and the door opens.

If you need more help, Im glad to make a demo file for you.
 

uupa99

Member

Thank you. I will test this. Oh and can't I just for the object the player needs to move make it trigger with player touch and set the path to move away from player?
---------------
Edit:
Ok... ive done everything and i'm a bit confused on the door part... just overall what do I do with the door. I would like to use 173-Door04 and have it in the closed position when the switches are off and when switches are on have it in open position along with a sound right when it opens plus when the player touches the door they get transported to a different map which will be the next room.
 
uupa99":3fst413i said:
Thank you. I will test this. Oh and can't I just for the object the player needs to move make it trigger with player touch and set the path to move away from player?

Yes. Do that.

Ok... ive done everything and i'm a bit confused on the door part... just overall what do I do with the door. I would like to use 173-Door04 and have it in the closed position when the switches are off and when switches are on have it in open position along with a sound right when it opens plus when the player touches the door they get transported to a different map which will be the next room.

The event that checks the switches should make the door opening sound when they are both activated.

The door itself should have two pages. Page One will be the shut door.

Page Two would have the Page Conditions of both switches being ON. It should probably be a Player Touch event that Transfers the Player to a new room, of course.
 
two pages on the door. page one like this
door1.jpg

page two something like this
door2.jpg
or you can change it from 'action button' to 'hero touch'

edit: hmmm, well, pushing the rock onto the event and triggering a switch is easy, i'm trying to figure out how to have it NOT trigger, if the rock is pushed off then.
 

uupa99

Member

For the buttons, when the rocks are pushed on the buttons nothing happens but when the player does then the buttons work but the door dosn't open. I'm confused. The buttons are set to event touch too.
 
For the life of me, I can't tell how you constructed your event system from your description. However, in the event that you are confused on this score: Event Touch only means that it is triggered if the Event Touches the player-- not if the Event touches another Event.

That said, in an effort to be helpful, I'm going to post something that I worked up a while back that may be useful for you. These are screenshots of a single-boulder version of that puzzle. (Sorry, I never got around to crafting a two-boulder version, but you ought to be able to figure out how to modify this from the other comments in the thread. If not, ask, I'm sure I'll be able to help once I get over this flu.)

First, we have the basic map. Push the boulder onto that little piece of grass. Not too tricky, right?

BoulderPuzzle1.png

So let's look at the parts. This is the boulder:
BoulderPuzzle2-1.png

It moves slowly, but if the player moves into it, it rolls away from them. No problem.

Now we'll need an event to keep track of where the player is in the room. For teaching purposes only, I am giving this event graphics, and only having it track the player's position.
BoulderPuzzle3.png

This event is, in turn, tracking the boulder. In an actual game, this event and the previous one would be combined.
BoulderPuzzle4.png

At this point, I ought to mention the door. Note that it's using Page 1 conditions, and thus not doing a darned thing.
BoulderPuzzle5.png

Now comes the part where we check if the player, or a boulder, is on that switch. Again, in actual play, this event wouldn't have graphics, and would be combined with those two harpies from earlier-- I just broke this up to show the different parts of the puzzle.
BoulderPuzzle6.png

Now the door will open if there is weight on that bit of grass! Oh, but wait-- we don't want this to be too easy. Something needs to stay on that bit of grass for the door to stay open. So here's the tricky bit-- the event will now check to see if there's nothing on the switch.
BoulderPuzzle7A.png

BoulderPuzzle7B.png

The careful observer will note that I have the door open visibly whenever the conditions are true. That's deliberate-- making the player guess as to whether they've solved the puzzle yet would just be a pointless time-waster, in my opinion, and they wouldn't be able to get the clue of the door opening when they step on the grass.

So, the "Door Open" switch is ON. That can only mean:

BoulderPuzzle8.png

That the door can now be used as a door.

That's the single-boulder version. Adding another boulder would mean... let's see, adding checks for the other boulder's location, adding checks for both trigger locations... when I'm less feverish, I can work it through, but it's not substantially different than what I've done here.

That should give you the basic concept, at least. Was that clear, or did it need any additional explanation?
 
well, yeah, it's way more complicated then a first glance, i was doing a test game of it, but i can't get 2 boulders to work :(
if you want i can upload the game that has one boulder.
or if you assign a boulder to each switch it works
(i couldn't get boulder 1 and 2 to work for both switches)
it would make it more of a puzzle. or color the boulders to match the switches XD
 
Uh, which conditional branch were you referring to? I used like six or so of them throughout the event system.

The first ones to turn up are in the first page of the Door Checker.

The first set, two nested Conditional Branches, works like this:

IF (Player X) is equal to (the fixed X of the trigger square)...
AND
IF (Player Y) is equal to (the fixed Y of the trigger square)

THEN Show the door opening.

The second set works the same way, but checking the X and Y of the boulder.

The next set, I will grant, is more confusing-- that's the set that closes the door again if there's no weight on the pressure switch.

I'll try to break it down a bit.

First: IF the Player's X is NOT equal to the X of the trigger square, AND either the Rock's X is NOT equal to the X of the trigger square, or the Rock's Y is NOT equal to the Y of the trigger square, THEN there's nothing on the trigger square, so shut the door.

However, IF the Player's X IS equal to the X of the trigger square, but the Player's Y is NOT equal to the Y of the trigger square, and the Rock's X and Y are NOT equal to the X and Y of the trigger square, THEN there's still nothing on the trigger square, so shut the door.

Yeah, that's a mouthful. However, if you want to create complex puzzles, you will need to be able to think this way.

You could make the puzzle slightly simpler, I suppose, if you wanted the puzzle to not be triggered by the player's weight, and by having the boulders lock in place once they are on the trigger squares. Then you could eliminate the "nothing on the trigger square" page.

However, if you are looking into making these kinds of puzzles routinely, you'll want to study what goes into them, and be ready to create this kind of system, complex IF...THEN...ELSE statements and all.

...yeah, learning computer programming in now-obsolete languages is still useful. You've got to think like a serious programmer if you want to create complex logic puzzles.
 

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