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:

Business strategy with Hamilton Helmer (author of 7 Powers)

Hamilton is one of the world’s leading experts on business strategy and the author of the seminal book 7 Powers: The Foundations of Business...

Contact Form

Name

Email *

Message *