How do I...Create a SeeSaw-like object?

Get help using Construct 2

Post » Wed Apr 24, 2013 5:49 am

I didn't know how to create it, but the logic maybe like this..

1. If there's an object on the SeeSaw board on the left side, the seesaw-board's angle will be increased.
2. If the object on the right side, the seesaw-board's angle will be decreased.
3. If the object not on the seesaw board, the seesaw-board's angle will be turn back to it's normal condition.





Anyone can help me?



Thanks and sorry for my bad english.
B
7
Posts: 14
Reputation: 603

Post » Wed Apr 24, 2013 8:09 am

Have you tried the Physics Object?
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Thu Apr 25, 2013 4:46 am

[QUOTE=procrastinator] Have you tried the Physics Object?[/QUOTE]

Mmm..nevermind. How to do it?
Because if using physic, how to revert back the seesaw board to the normal condition?


Thank you for your reply...
B
7
Posts: 14
Reputation: 603

Post » Thu Apr 25, 2013 6:37 am

click to drag boxes

preview

seesaw returns to its normal position with 'apply torque towards angle', with a torque force that is proportional to the angle difference (otherwise it will vibrate back and forth)
i dont think you need to make the force proportional though.. you could just try setting the angular damping very high

capx
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Thu Apr 25, 2013 9:39 am

[QUOTE=keepee] click to drag boxes

preview

seesaw returns to its normal position with 'apply torque towards angle', with a torque force that is proportional to the angle difference (otherwise it will vibrate back and forth)
i dont think you need to make the force proportional though.. you could just try setting the angular damping very high

capx[/QUOTE]

Beautiful!
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
53
S
16
G
8
Posts: 6,157
Reputation: 19,744

Post » Thu Apr 25, 2013 1:08 pm

[QUOTE=keepee] click to drag boxes

https://dl.dropboxusercontent.com/u/53374990/Forum/seesaw/index.html : preview

seesaw returns to its normal position with 'apply torque towards angle', with a torque force that is proportional to the angle difference (otherwise it will vibrate back and forth)
i dont think you need to make the force proportional though.. you could just try setting the angular damping very high

https://dl.dropboxusercontent.com/u/53374990/Forum/seesaw/seesaw.capx : capx
[/QUOTE]

[QUOTE=LittleStain] Beautiful![/QUOTE]

Yeah,agree that, beautiful example! Thanks for your help @keepee & @LittleStain .


And another question, how to implement it to platformer behaviour?

I've add a sprite called player, give it platform and physic behaviou but it give weird result.
https://www.dropbox.com/s/0b8rnlo9ye48sl1/seesaw.capx

Many many thanks ahmadnbl2013-04-25 13:10:46
B
7
Posts: 14
Reputation: 603

Post » Thu Apr 25, 2013 2:07 pm

Physics doesn't like working with other methods of moving an object (the player).

Haven't got time to check your capx right now, but off the top of my head, just assign Physics behaviour to the player (no platform behaviour). Then you'll need to hardcode events for movement. Easy enough to do.. for instance, to jump with space bar..

+ On Key Pressed (SPACEBAR)
- Apply Impulse At Angle 270
(you'll have to play around with force until it feels right for you)

For moving..

+ On Key Down (LEFT_ARROW)
- Apply Force At Angle 180
(Force will be much smaller than impulse because it updates Force every tick, whereas impulse is a one shot deal, hence why it's suitable for jumping)

and so on.procrastinator2013-04-25 14:07:55
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Tue Apr 30, 2013 1:37 pm

[QUOTE=procrastinator] Physics doesn't like working with other methods of moving an object (the player).

Haven't got time to check your capx right now, but off the top of my head, just assign Physics behaviour to the player (no platform behaviour). Then you'll need to hardcode events for movement. Easy enough to do.. for instance, to jump with space bar..

(...) [/QUOTE]

But I need the platform behaviour, for the state when the object is landed on the floor, is moving, is falling, and so on.


But I had trying your idea but there's some problem. When the object is moving the object is rolling, can't standing.

Btw, thanks for your help
B
7
Posts: 14
Reputation: 603


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Ahmet Kaan, Megavolt, mnashwan, shinkan, stylie1, tarek2 and 15 guests