C
CydoEntis
Guest
I am currently making a tank based game and was curious how can I make the tank move back and forth based on the angle the tank is facing, and how can I have the gun move independently? Like an actual working tank?
My code looks like this
Here are some things I have tried.
My code looks like this
Code:
//Tank Movement Variables
var up = (keyboard_check(ord("W")));
var down = (keyboard_check(ord("S")));
var left = (keyboard_check(ord("A")));
var right = (keyboard_check(ord("D")));
// Tank Movement Code
if (up) {y -= 4; } // Move the tank Up
if (down) {y += 4; } // Move the tank Down
if (left) {image_angle += 2} // Move tank at an angle left
if (right) {image_angle -= 2} // Move tank at an angle right
Code:
// Tank Movement Code
if (up) {direction -= 4; } // Move the tank Up
if (down) {direction += 4; } // Move the tank Down
if (left) {image_angle += 2} // Move the tank Left
if (right) {image_angle -= 2} // Move the tank Right
Last edited by a moderator: