Hello guest! Login or Register
Construct 2 r90

Released Friday, May 11, 2012 at 2:01:09 PM

28mb for Windows XP, Vista & 7

Free Download
Download Manual

Coming Soon

Bullet behavior


The Bullet behavior simply moves an object forwards at an angle. However, it provides extra options like gravity and bouncing that allow it to also be used like a bouncing ball. Like the name suggests it is ideal for projectiles like bullets, but it is also useful for automatically controlling other types of objects like enemies which move forwards continuously.

For two examples of the Bullet behavior see Bouncing balls.capx and Bouncing bullets.capx in the Examples folder in the Construct 2 install directory.

Bullet properties


Speed
The bullet's initial speed, in pixels per second.

Acceleration
The rate of acceleration for the bullet, in pixels per second per second. Zero will keep a constant speed, positive values accelerate, and negative values decelerate until a stop (the object will not go in to reverse).

Gravity
The force of gravity, which causes acceleration downwards, in pixels per second per second. Zero disables gravity which is useful for top-down games. Positive values cause a parabolic path as the bullet is bullet down by gravity.

Bounce off solids
If set to Yes, the bullet will bounce off any objects with the Solid behavior. It will also calculate the angle of reflection to bounce off realistically depending on the object's shape and angle.

Set angle
If set to No, the behavior will never change the object's angle. If set to Yes, the behavior always sets the object angle to the angle of motion.

Bullet conditions


Compare speed
Compare the current speed of the bullet, in pixels per second.

Bullet actions


Bounce off object
Make the bullet bounce off an object it has just touched. Since this requires the bullet have only just touched the object, it is generally only useful in an On collision event. It will also calculate the angle of reflection to bounce off realistically depending on the object's shape and angle. If the bullet is not currently overlapping the given object, or is stuck deep inside it, this action will have no effect.

Set acceleration
Set the bullet acceleration in pixels per second per second.

Set angle of motion
Set the angle the bullet is currently moving at, in degrees.

Set enabled
Enable or disable the movement. If disabled, the behavior will stop moving the bullet, but will remember the current speed, acceleration etc. if enabled again.

Set gravity
Set the acceleration caused by gravity, in pixels per second per second.

Set speed
Set the bullet's current movement speed, in pixels per second.

Bullet expressions


Acceleration
Get the bullet's current acceleration in pixels per second per second.

AngleOfMotion
Get the angle the bullet is currently moving at (which can be different to the object's angle), in degrees.

Speed
Get the bullet's current movement speed in pixels per second.

Previous Entry
Bound to layout
Next Entry
Car

Feedback on this page
How useful was this page for you?
Do you have any suggestions for this page?