movable object that leave trail gamemaker

https://www.youtube.com/watch?v=x29Ok-VxHhw
Information about object: obj_tank
Sprite: spr_tank
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

tyre=5;//set inital tyre timer

Step Event:
execute code:

///movement code
if keyboard_check(ord('A'))
{
image_angle+=2;
direction=image_angle
}
if keyboard_check(ord('D'))
{
image_angle-=2;
direction=image_angle
}
if keyboard_check(ord('W'))
{
speed+=0.5;
}
if speed>20 speed=20;


speed-=0.2;//add friction
if speed<0 speed=0
execute code:

///tyre
tyre-=speed;

if tyre<0//if count, run the code
{
tyre=instance_create(x,y,obj_tyre);//create a tyre
tyre.image_angle=direction;//set angle to direction of tank
tyre=20;//restart timer
}


obj_tyre 
Information about object: obj_tank
Sprite: spr_tank Solid: false Visible: true Depth: 0 Persistent: false Parent: Children: Mask:
No Physics Object
Create Event:
execute code:

tyre=5;//set inital tyre timer
Step Event:
execute code:

///movement code
if keyboard_check(ord('A'))
{
image_angle+=2;
direction=image_angle
}
if keyboard_check(ord('D'))
{
image_angle-=2;
direction=image_angle
}
if keyboard_check(ord('W'))
{
speed+=0.5;
}
if speed>20 speed=20;


speed-=0.2;//add friction
if speed<0 speed=0
execute code:

///tyre
tyre-=speed;

if tyre<0//if count, run the code
{
tyre=instance_create(x,y,obj_tyre);//create a tyre
tyre.image_angle=direction;//set angle to direction of tank
tyre=20;//restart timer
}

No comments:

The Win Machine

The Road to Hell is Paved with Intervention ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏    ...

Contact Form

Name

Email *

Message *