General Gravity

Discussion and feedback on Construct 2

Post » Mon Sep 05, 2011 10:47 pm

Alright, I know about the platformer behavior but is there way to apply gravity to an object without using the platform-er behavior? I want to apply it to a bullet so that it will eventually fall to the ground.
Thanks in advance!
B
29
S
5
G
6
Posts: 58
Reputation: 5,121

Post » Mon Sep 05, 2011 11:01 pm

Also, how do you access the sprite/audio packs that come with Construct 2? I have yet to find them. :D
B
29
S
5
G
6
Posts: 58
Reputation: 5,121

Post » Mon Sep 05, 2011 11:01 pm

You could do something like Every tick: Set bullet Y to ObjectName.Y+100*dt, where 100 is how much (in pixels) it would move in one second. dt or timedelta just makes the move smooth.

On your second question - if you bought it the link's in your email.Somebody2011-09-05 23:02:16
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Mon Sep 05, 2011 11:17 pm

thanks!
doesn't the free version have sprite/audio packs as well?
B
29
S
5
G
6
Posts: 58
Reputation: 5,121

Post » Mon Sep 05, 2011 11:19 pm

http://www.scirra.com/freebundle.zip, link available in early adopter.Kyatric2011-09-05 23:20:42
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Mon Sep 05, 2011 11:28 pm

actually, set y to object.y+100 causes the object (bullet) to immediately jump to the bottom.
B
29
S
5
G
6
Posts: 58
Reputation: 5,121

Post » Mon Sep 05, 2011 11:35 pm

perhaps i can just move the object down a few pixels every tick and rotate it down a few degrees every tick?
B
29
S
5
G
6
Posts: 58
Reputation: 5,121

Post » Mon Sep 05, 2011 11:36 pm

100*dt <== This is important, don't leave it out. deltatime is the amount of time between ticks which sums up to 1 each second. So if you want that to move 100 pixels per second you do a Each tick: 100*dt

You could also add to the angle, something like 30*dt each tick instead of this. It's up to you.Somebody2011-09-05 23:38:08
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Tue Sep 06, 2011 12:17 am

i have a lander clone demo i did a while back that uses math for the gravity. it is fully commented out, and may help you if you like.

http://dl.dropbox.com/u/6707683/construct.../hilander.capx

you can try it, to see if this is the type of gravity movement you want...

http://dl.dropbox.com/u/6707683/construct.../hilander%20htlm5/index.htmlharrio2011-09-06 00:19:26
B
52
S
17
G
15
Posts: 1,029
Reputation: 26,339

Post » Thu Sep 08, 2011 12:26 am

not exactly what i need but still useful anyways, thanks!
B
29
S
5
G
6
Posts: 58
Reputation: 5,121

Next

Return to Construct 2 General

Who is online

Users browsing this forum: 99Instances2Go, Artpunk and 13 guests