Bullet movement

New releases and general discussions.

Post » Tue Mar 18, 2008 6:24 pm

Suggestions for bullet movement, gravity.

When my bullets are shot out I want them to curve slightly for extra realism! Sort of like in soldat.
Image Image
Scirra Founder
B
124
S
37
G
25
Posts: 3,945
Reputation: 44,897

Post » Tue Mar 18, 2008 6:34 pm

You can already do this with events. try:

if angle is greater or equal to 90
if angle is less than 270

Rotate clockwise 1 degree

if angle is greater or equal to 270
or
if angle is less than 90

rotate clockwise 1 degree

That should work. You might have to use three events instead, with:

angle less than 90 and greater than or equal to 0 -> rotate clockwise 1 degree
and
angle greater or equal to 270 and less than 360 -> rotate clockwise 1 degree
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Tue Mar 18, 2008 6:57 pm

That would make a circular curve, which might be OK, but isn't a parabolic curve like you would get in real life. An easy way to do that would just be to apply a downwards acceleration to the bullet via events, eg:

+ Always
: Add 100 * TimeDelta to 'YVelocity'
: Set bullet Y to .Y + 'YVelocity'
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Tue Mar 18, 2008 7:07 pm

Good point :)
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Wed Mar 19, 2008 9:12 am

Thanks for a solution, but would it not be easier to have this as a checkbox and text field parameter to be easier to apply?
Image Image
Scirra Founder
B
124
S
37
G
25
Posts: 3,945
Reputation: 44,897

Post » Wed Mar 19, 2008 12:20 pm

And a "do my game for me" checkbox maybe? :)

I'm just kidding, but consider that what you suggested it's really elementary coding.. then we would need a million checkboxes for ANY possibility of things happening in videogames.. :P
B
2
S
1
G
5
Posts: 70
Reputation: 1,540

Post » Wed Mar 19, 2008 12:47 pm

No, I think it's a valid suggestion. You can do bullet accuracy in events too, but it's a pain and you need to know how to adjust an angle by a random amount. It's a logical addition to the bullet movement.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 4 guests