Page 1 of 1
How can I do this?
Posted:
Mon Dec 26, 2011 6:16 am
by raminkhan
okay its a piece of wood hanged by two ropes. I want to make it so that like angry birds how the user can stretch the rubber as much as you want, so here I want to let the user to stretch the wood back as hard as they can and then let go. How?
Please see the picture for better understanding.
Re: How can I do this?
Posted:
Mon Dec 26, 2011 6:26 am
by skydereign
First two things that came to mind. It isn't especially easy to do, assuming you want to make it realistic. You can do the slingshot mechanics by having a resting point, and using its initial position and a mouse button down event to determine the position (xmouse, ymouse) but the actual string actors will have to be drawn with canvas. So for the slingshot clicking the actor will trigger a variable so that it can use the xmouse ymouse to position the actor, and when it is in position you update the strings. You can limit the length you can pull the platform back with by using some simple trig (cos/sin of a circle). This method won't rotate the wood though, so you'll have to do animation rotation as well as some physics calculations to make a convincing rotation effect though.
If you want to use gE 1.5's physics, then you would use three distance joints, break the wood into two parts, and have them connected by one of the distance joints, and then the strings connecting to the different pieces. I don't believe distance joints are elastic though, so it would be limited to just a swing unless you use some trig on the dots to which it connects.
Re: How can I do this?
Posted:
Mon Dec 26, 2011 6:45 am
by raminkhan
so sorry to extremely bothering you My dear sky and I dont mean to be lazy but I just completed physics 1 in CUDenver, and I dont have a flipping clue how to apply spring elastic formula and newtons in GE so is there anyway you could do a simple demonstration I dont want to make you to do it all but a simple start up to get me going. THanks my dear help friend.
NOT YELLING
BUT I DONT KNOW HOW TO THANK YOU SKY YOUR REALLY BEEN SO HELP FULL TO ME THANKS BUD.
Re: How can I do this?
Posted:
Mon Dec 26, 2011 9:47 am
by skydereign
Well, here is the start you were asking for. This should be enough to get you going on a convincing enough effect. It is a little harder since you have two strings to calculate, but you can ignore that as you should be able to get a generally accurate directional_velocity without actually doing any physics type stuff (angry birds didn't use real slingshot physics either).
Re: How can I do this?
Posted:
Thu Oct 24, 2013 3:09 am
by 247wkman
i remember the magnet game (the colorful one that picked stuff up of the conveyor belt in the video ad) that used rings sprites locked together by ball sprites- it used no code, just the auto-physics. it fell under gravity and swang (though it could have used more links for a more fluid motion and had little counter swing) when dragged- the ring sprites were set invisable and canvas used to draw the rope. doing an adapted version might work with this ged.