R
Remeuf
Guest
Hello everyone,
I have another problem with my tank. It consists of two objects on top of each other and independent in rotation but not moving. They must be able to orient themselves independently but to advance exactly the same. Here in my code the turret and the vehicle turn correctly but when the whole advance, the turret goes away elsewhere which is a bit annoying for a tank ...
Question # 2: How do you display the result of a variable on the game screen?
The code is identical for the 2 sprites
I have another problem with my tank. It consists of two objects on top of each other and independent in rotation but not moving. They must be able to orient themselves independently but to advance exactly the same. Here in my code the turret and the vehicle turn correctly but when the whole advance, the turret goes away elsewhere which is a bit annoying for a tank ...
Question # 2: How do you display the result of a variable on the game screen?
Code:
// Rotation char
var droite;
droite = keyboard_check(vk_right);
if (droite)
{
image_angle += -1;
}
var gauche;
gauche = keyboard_check(vk_left);
if (gauche)
{
image_angle += 1;
}
// Rotation tourelle
var dir = point_direction(x,y,mouse_x,mouse_y);
image_angle = dir-90;
// Tank avance
var avance;
avance = keyboard_check(vk_up);
if (avance)
{
x += lengthdir_x(4,image_angle+90);
y += lengthdir_y(4,image_angle+90);
}