this is mostly for gm pro but it will work for gm 7
First, I will show you how to make the rotation. First click “sprite”, then type this 32x 32y. This is very important.
Then click “add event>step>step”
And type the following code
Code: if speed>5 speed=5
friction=0.3
So what does this mean?
I'll tell you:
Code:
if speed>5 speed=5
This means, that if the speed is larger than 5, the speed is 5.
It basically sets the max speed for the tank or car.
Code:
friction=0.3
This makes the tank or car glide a little bit when you have stopped driving.
The higher value you have, the shorter it will glide.
Ok now click “add event>keyboard>up”
And put some code into it.
Code: motion_add(image_angle,+0.4)
Ok now click “add event>keyboard>left” Now, lets put some more code in.
Code: direction+=5
image_angle+=5
Ok, now, click
“add event>keyboard>right” Now, lets put some more code in.
Code: direction-=5
image_angle-=5
And if you want them to back up then click “add event>keyboard>down”
Code: motion_add(image_angle,-0.4)
Ok, now, we have got that covered. If you want to make a tank or car, then name your object:”tank”. Now make a new object and name that “turret” and type 32x 15y
Now click “add event>step>step”
And then put some code in it.
Code: image_angle=point_direction(x,y,mouse_x,mouse_y)
x=tank.x
y=tank.
And there you go. Now, if you want to make him shoot a bullet, then create a new object and name it “bullet” and click “add event>create” and add some code.
Code: direction=point_direction(x,y,mouse_x,mouse_y)
Code: image_angle=direction
speed=10
If the bullet goes too fast then just change the 10 into what ever number you want (the higher the faster).
Now, click add
“add event>other>outside” room and put some more Code in it.
Code: instance_destroy()
this took me some time but i got soo you can do it too.