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.

Keeping a event on a certain place[RESOLVED]

The title doesn't explain it that well. So I will begin:
In my game you can push stones. If you move a stone, you will get through a place.
But, when I leave the map. And return, the stone will be on his original place. So
you can't get back. Is there a way so that the stone will keep standing were
you placed it?
[w]=warp
[p]=player
[a]=spot A!
[r]=Stone
[n]=Not passable
[ ]=Passable

[w][n][n][n][n][n][n]
[ ][n][n][n][n][a][n]
[ ][ ] [ ] [ ][ ][r][n]
[n][n][n][n][n][p][n]
                   [w]
Player pushes stone to spot a. Player can now go on to the next stage, hooray!
Player went to other map. But he forgot something in a other map, he quickly
dashes back. But when he comes back in this map. The stone that he moved
to point a, is now back at his original place again. Aaaww, player can't get back.
And need to restart the game from his savepoint.

Player: "WTF!!! I WENT THROUGH ALL THAT TROUBLE! AND CAN'T GET BACK!"

Player smashes his computer. Computer crashes, game ruined. Player never wants
to play the game again.

Player: "I know that I can make a better game. But first...I need a sandwhich!"

So does someone know a way to keep the stone on spot a?

Thank you all in advance.
 
There are two ways you can do this, although one requires a script.

If you want the rock to stay in its position regardless of where you want, I can link you to a script that does that.

If you want the rock to stay in its position ONLY if it's on Spot A, and to reset if you leave the map when it's not on Spot A, you can do this with events.

What you need to do are create two events for the rock, one in it's initial starting place and one in Spot A. Put move event commands on this rock. Now create a second page with "New Page" and check a Switch box under Conditions. Select a switch you want, and keep that in mind. Leave this page with no graphics or commands.

On the second event, leave the graphic blank and set it to Parallel Processing. Assign variables to the Map X and Y coordinates of the first rock event. Now use a Conditional Branch to check if the variables are equal to this event's coordinates on the map. If so, turn the aforementioned switch on.
Create a New Page again on this second event, check the Conditions switch box again, and select the switch. Give this page a graphic and you're done.

Good luck with it killeryunran :thumb:!
 
Actually, I just want it where the player left it. So, if he could push the stone
somewhere else. Then I want to let that stone stay on that place. Is there
a way to do that? Or do I have to use script's for that?

But still thanks for the other advice.
 
Ah, I have the answer to this. I did this in my game.

have an event that is on paralell process that assigns the X and Y co-ordinates to two variables.

Variable Rock X: X pos. of Rock
Variable Rock Y: Y pos. of Rock
Wait: 1 frame.

Then have ANOTHER event on paralell process that sets the location of the Rock according to those variables. Then have the "Erase Event" command after that. This will mean that the rock will move to those variables only once, when you enter the map for the first time.

One thing, on the second event, you will need two pages. The first has "Turn Self Switch A on", and then erase the event. The second page does the above task, activated when switch A is on.

The reason for this is that until those two variables are used, their value will be 0, so that when you wnter the map for the very first time, the rock will jump to the top-left of the map. This way, the game will look for where you've placed the rock before moving it.
 

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