Rock/Block Movement Problem

Well, I'm here again with another help request.

 

I have been working on a very small "prequel" game to The 13th (I have been hit by writers block, and have no idea where I wish to go with the story, so I'm taking a break.) However, this "prequel" game is a puzzle game. Building the puzzles is the easy part for me, but getting the puzzle mechanics to work is where I am stuck. I have about 3 problems that are bugging me at the moment, but I'm going to start with one for now. The others will be posted once I am done attempting to "fiddle" with them. Anyway, umm... LETS-A-GO!!!

 

In this puzzle, the player must push some rocks around to either move them out of his/her way, or to put them on a button to open the way forward. However, alongside this puzzle is a working puzzle mechanic that allows the player to switch between orange and green walls. [Code Named: Bricks] (The bricks are opposites to each other, so... kinda like the red and blue walls in LOZ a Link to the Past.) Anyway, there is a picture to show the basics of what I have before the problem shows up.

 

before_rock_is_inside_block.png

 

After that, if a rock happens to be in the location of a brick when it is activated, or "put up", the rock will be inside the brick. This part I am fine with, as it will make the player think pretty heavily about what to do. Well, if I build the puzzle right.

 

rock_inside_block.png

 

However, the problem occurs when I approach the rock while it is inside the brick. Since the rock is set to activate on player touch, it will roll out of the brick, as shown below:

 

what_happens_when_i_push_on_the_block_containing_the_rock.png

 

Any ideas as to how I can fix this in a relatively simple manner? I plan on making many puzzle rooms with this same mechanic, so if the mechanic is overly complex or hard to put into effect, it may be scrapped, as the work load and hassle won't be worth the effort. (I wouldn't be able to make sure the puzzle is loophole free and impossible to get stuck in, as I would end up spending too much time working on that one aspect of the puzzle.) But, it just depends. I would love to have an evented mechanic that I can easily copy and paste, but, if that's not possible, I understand.

 

Thank you in advance,

 

-pepper-
Interesting puzzle idea you have there. 🙂

For your question, you could give the tiles where bricks could possibly spawn on the region ID "1". Inside the rock, you check if a switch "Bricks up" is ON, and if yes, you get the rock's X/Y coordinates. Then, get the region ID of those coordinates just stored. If the "Brick [is] up" and region ID is "1", then your rock is inside a brick. Therefore, you don't do anything, else: move it.

For multiple brick colors, you just need more switches and different region IDs. "Red Brick up" and region ID "1" is unmovable, "Blue Brick up" and region ID "2" is unmovable etc.

Does this help?
This might not be a very efficient solution as I'm not a RM pro but you could use two variables to track rock's X and Y position and if player attempts to push the rock, the X and Y is checked. If it's the same as the brick's position then nothing happens.

so the rock event would be something like this:

control variables (this event's map X)

control variables (this event's map Y)

conditional branch: if rock's X and Y are the same as "brick" X and Y then nothing happens

otherwise move away from player

EDIT: Liak was first. My post is a pretty similar idea, I'm sorry 🙂
Damn it. Kurisu's solution is much, much easier. 😀 (But mine is more creative, haha.)

EDIT: Well ... or maybe not. Kurisu, let's say he wants to move around bricks or use this puzzle several times. I think he would need something more "abstract" that doesn't require to get every single brick's coordinates to compare. So, my solution might still be better. Or you could check the player's facing direction, get the coordinates of that spot and do something with that ("Is there a brick in front of me?") ... huh ... I have to think about that.

By the way, does that even work, with two events sharing the same spot? Does that ALWAYS trigger the rock? I could imagine the engine checks the Brick and says: "All right, nothing to do here".
Resetting the puzzle would not be a problem, but If there is a really large number of bricks then it would be much work to set it up, you are right Liak.

This is why I said it's probably not the best solution 🙂 It will just work for what I see in the screenshots.
the speedy replies on this forum still amaze me, i sit through one college class and already im given such greatness! 😀 anyways, thanks for the help kurisu, but i think liak's idea will work better since i will be making bigger and many more, puzzles with the mechanic. however, liak, although i do follow the logic of what you have said, ive never used the check x and check Y option. (and ive no idea how.) and on top of that, how do i check somethings current region? i have regions put in (now) as region 1 for green bricks, and region 2 for ornage bricks. along side this, the bricks are operated by switching a "ON/OFF" switch. that is set to be either on or off when the room starts. (i beleive orange bricks appear when the switch is off, and green when it is on. so how would i go about putting ur idea into effect?
In the rock event: Control Variables command -> Game Data -> Character -> This event -> Map X/Y. 🙂 You need 2 variables to store the X and the Y information. After that, go to the third page of event commands, there you find "Get Location Info" which allows you to store the Region ID of the tile you specify with the Map X and Map Y stored before (designation by variable).

Then you can just compare all these information with conditional branches. You basically know what region ID is under the rock, and you can also check if your switch is ON or OFF. If both information somehow "coincide" (so if the region ID is "1" and the switch says that green bricks are up, the rock you just triggered appears to be in a green brick), nothing happens, or you play a SE that tells the player about the rock being blocked. Else, the rock moves.

Should you need any more help, feel free to ask. 🙂
Ok, so I have found the two event buttons you mentioned, (RPG Maker VX Ace, still surprises me. I'm surprised I didn't find those sooner.) However, since I don't know how they really work, the rest of your explanation was really confusing XD sorry. would you be able to put together a very small demo? with like two rocks minimum? being able to fiddle with the code and look at how its arranged will allow me to learn alot better than just words. (I am a kinesthetic, or a hands-on learner.) I'm actually messing with the two code lines you just introduced me to, but its not quite "clicking". If you can't post a demo, Pictures would be really helpful...
Bricks-and-Stones.exe
 

Here we go. 🙂

(This demo might even be interesting for other people, as it includes the feature that the rock doesn't move, change direction or play an SE when it is blocked by other events.)
Thanks a ton Liak! 😀 ill send you a link to the next problemswhen i get around to posting them, well, if you wanna take a look at them. 😛
You're welcome. 🙂 Yeah, why not, send me a link to the topic. I don't claim to be an expert on eventing in general, though. I just happened to know about how powerful "Get Location Info" can be because I have been using it a lot lately.
Why not just ask them in the forum, instead of depending on one person just because they've helped you in the past?


Anyway ... I'm assuming your other problems are not related to this one, so when you're ready, you can start new threads for them.


This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/rock-block-movement-problem.19965/