How do I push up and down

Just started using Construct 2? Post your questions here

Post » Wed Oct 19, 2016 8:28 am

Hello,
I need advice. I want to create a game based on the principle SOKOBAN game. I have no problem to program the push and pull. Solid box is then pulled along the platform ground. Likewise, I have no problem using physics program push and pull the object.
I can not, however, advise that box that I want to pull the pull and I as a player to him could bring all sides and move in that direction. What behavior will set the player (8 direction, plaform?) What has to be programmed?
Thank you for any advice.
Regards
B
2
Posts: 7
Reputation: 166

Post » Wed Oct 19, 2016 8:42 am

Hi @chcteacher !

I'd like to help you, but I have difficulties to understand this sentence :
chcteacher wrote:I can not, however, advise that box that I want to pull the pull and I as a player to him could bring all sides and move in that direction.


Regards
Image
B
10
S
3
G
2
Posts: 75
Reputation: 1,708

Post » Wed Oct 19, 2016 9:52 am

Message: chcteacher can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
I am sorry for my English.
I want to create a game SOKOBAN. On the surface I want to give a box, which I'll pushes the player. Box will move in a direction in which the player pushes.

https://en.wikipedia.org/wiki/Sokoban
B
2
Posts: 7
Reputation: 166

Post » Wed Oct 19, 2016 10:45 am

No problem, I'm not a native English either. :P

So, you can move the box using events, but you don't manage to make the player push and pull the box? Is that it? Would it be possible to see how you programmed your events?
Image
B
10
S
3
G
2
Posts: 75
Reputation: 1,708

Post » Wed Oct 19, 2016 11:08 am

Message: chcteacher can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
If you look at the image layout, so I need to get a box to exit the position.
Box I want to move in space layout. Up, down, left, right.
Now I have set:
BOX- a solid platform
Player- platform
Now I can move to the left and to the right. I need a box to up move and down move, like in the game SOKOBAN.


https://drive.google.com/file/d/0B2f9uToDb5FHS0RTMEZqOEkzZTQ/view?usp=sharing
https://drive.google.com/file/d/0B2f9uToDb5FHTkJfNkFzZ3lvdFE/view?usp=sharing
B
2
Posts: 7
Reputation: 166

Post » Wed Oct 19, 2016 12:20 pm

Alright! First, you can remove the Platform behavior from your box, because you won't use it for up and down movements. Then, that's how I would advise you to proceed :

Code: Select all
Condition : Prekryti is overlapping Box
                      Condition : Player.X < Box.X  AND Right Arrow is down
                                           Action : Set Box.X to Player.X + distance(Player.X,0,Box.X,0)
                      Condition : Player.X > Box.X  AND Left Arrow is down
                                            Action : Set Box.X to Player.X - distance(Player.X,0,Box.X,0)
                      Condition : Player.Y < Box.X  AND Down Arrow is down
                                            Action : Set Box.Y to Player.Y + distance(0,Player.Y,0,Box.y)
                      Condition : Player.Y > Box.Y  AND Up Arrow is down
                                            Action : Set Box.Y to Player.Y - distance(0,Player.Y,0,Box.y)


That should work. ;)
Image
B
10
S
3
G
2
Posts: 75
Reputation: 1,708

Post » Sat Feb 04, 2017 3:57 pm

Hello good afternoon I've tried to do the sokoban with your code but I can not get it, help me otherwise Thanks

To try it does not move

I have been searching the forums but there are not many answers to this topic

I would like to use 8direction
Image
B
16
S
3
G
1
Posts: 10
Reputation: 1,371


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest