Block Pushing

For questions about using Classic.

Post » Mon Jul 26, 2010 7:31 pm

I'm trying to make pushable blocks for my platformer but I've had no luck so far. Does anyone have any examples/tips on how to do this? Basically I need to be able to push the block left or right and have it fall over ledges. I'd like to use physics for this but I couldn't get anything decent with it :T Thanks for any help!
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Mon Jul 26, 2010 8:58 pm

Give the Block the "Platform" Behavior. That'll give it automatic gravity too.

Now, for the movement, Use the "Set X Component of Movement" in the Platformer actions to make it move as your character is pushing ("Move Left/Right" Control is Down + Overlapping at Offset (0,1)) the block. Use an "Else" to set the movement back to 0 when you're not pushing it.

Hope this helps.
B
1
G
2
Posts: 3
Reputation: 631

Post » Mon Jul 26, 2010 9:00 pm

Here's a quick pushing example using the physics behaviour.

http://dl.dropbox.com/u/1646976/pushing.cap

I did make a custom movement version but it goes mental when a block lands on another block. I also got random lockups of the preview too. If you a need an example using custom movement I can have another experiment with it.

:)
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Mon Jul 26, 2010 9:20 pm

[quote="Xeno":vf3mmtjo]Give the Block the "Platform" Behavior. That'll give it automatic gravity too.

Now, for the movement, Use the "Set X Component of Movement" in the Platformer actions to make it move as your character is pushing ("Move Left/Right" Control is Down + Overlapping at Offset (0,1)) the block. Use an "Else" to set the movement back to 0 when you're not pushing it.

Hope this helps.[/quote:vf3mmtjo]

Here is a example using Xeno's method.

http://dl.dropbox.com/u/1646976/pushing2.cap

The thing is you can't give something platform behaviour without setting it's controls. So if you give the box platform behaviour and set it to player 2 controls that aren't set in the application properties the box will go mad and fly all over the place. So give it player 1 controls and set it to always ignore input.

:)
B
46
S
23
G
7
Posts: 459
Reputation: 6,763

Post » Fri Sep 24, 2010 11:57 pm

[quote="Minor":3bwv1ti6][quote="Xeno":3bwv1ti6]Give the Block the "Platform" Behavior. That'll give it automatic gravity too.

Now, for the movement, Use the "Set X Component of Movement" in the Platformer actions to make it move as your character is pushing ("Move Left/Right" Control is Down + Overlapping at Offset (0,1)) the block. Use an "Else" to set the movement back to 0 when you're not pushing it.

Hope this helps.[/quote:3bwv1ti6]

Here is a example using Xeno's method.

http://dl.dropbox.com/u/1646976/pushing2.cap

The thing is you can't give something platform behaviour without setting it's controls. So if you give the box platform behaviour and set it to player 2 controls that aren't set in the application properties the box will go mad and fly all over the place. So give it player 1 controls and set it to always ignore input.

:)[/quote:3bwv1ti6]

Great solution! :D I used it in my game, thanks!
B
2
S
1
G
2
Posts: 32
Reputation: 864


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests