D
Daydreamer
Guest
Hey guys, I started learning Game Maker Studio about a week ago. I have completed a few tutorials and made Pong on my own with a computer AI to play against. So not much experience. I have been using the manual to try and work things out or to try and take the completed tutorials further. This however really has me stumped.
I thought I would try and recreate Jet Fighter by Atari. The player and enemy fly around the room as jets trying to shoot each other down. When they turn in space they turn gradually. I can get the player movement no problem but I just can't work it out for the enemy AI. I have the enemy fly towards the player and shoot when in range but I can't pull off the turning aspect. This is my code for the player.
Create event
speed = 6;
direction = direction;
Step event // Player movement
if keyboard_check(vk_left)
{direction += 2;
image_angle = direction;}
if keyboard_check(vk_right)
{direction -= 2;
image_angle = direction;}
Outside room event
move_wrap(true, true, 0);
How can I take my player movement and apply it to the enemy jet. At the moment the enemy jet will fly directly towards the player using 'move_towards_point', and will only fire when in range by using 'distance_to_point'. If the player turns the enemy turns sharply. I have tried using 'direction' in various ways but just can't get the enemy to turn gradually like the player. The enemy jet can wrap around the screen but chooses not to. When the player leaves the screen and appears on the other side the enemy jet just turns back on itself. My code for the enemy became so messed up I had to start again. Would be great to get an idea of what to try or a recommended page from the manual or if you guys know of a tutorial that may help.
Thanks
I thought I would try and recreate Jet Fighter by Atari. The player and enemy fly around the room as jets trying to shoot each other down. When they turn in space they turn gradually. I can get the player movement no problem but I just can't work it out for the enemy AI. I have the enemy fly towards the player and shoot when in range but I can't pull off the turning aspect. This is my code for the player.
Create event
speed = 6;
direction = direction;
Step event // Player movement
if keyboard_check(vk_left)
{direction += 2;
image_angle = direction;}
if keyboard_check(vk_right)
{direction -= 2;
image_angle = direction;}
Outside room event
move_wrap(true, true, 0);
How can I take my player movement and apply it to the enemy jet. At the moment the enemy jet will fly directly towards the player using 'move_towards_point', and will only fire when in range by using 'distance_to_point'. If the player turns the enemy turns sharply. I have tried using 'direction' in various ways but just can't get the enemy to turn gradually like the player. The enemy jet can wrap around the screen but chooses not to. When the player leaves the screen and appears on the other side the enemy jet just turns back on itself. My code for the enemy became so messed up I had to start again. Would be great to get an idea of what to try or a recommended page from the manual or if you guys know of a tutorial that may help.
Thanks
Last edited by a moderator: