E
Evilperson
Guest
My game is like a typical infinite runner, except the player drives a car and the view is top-down.
To do this, I made a car object in the middle of the screen and tried to create the illusion of the car moving by making everything except the car itself move.
The tire tracks object works perfectly, like this:
direction = obj_player_car.image_angle + 180
speed = global.car_speed[global.current_car] + global.current_gear
The Problem:
I am trying to add enemy cars driving in all sorts of directions, while still maintaining the illusion.
Firstly, I tried adding a small car that drives 'south'. I wanted it to turn left and right.
I successfully made it drive 'south' while maintaining the illusion, like this:
speed = 10
image_angle = 270
direction = 270
motion_add(obj_player_car.image_angle + 180,global.car_speed[global.current_car]+ global.current_gear)
BUT when I tried adding the turning a few different ways, anomalies occured.
This is my latest attempt, which doesn't work.
if clockwise = false {
turn_value += 1
// motion_add(0,4)
} else {
turn_value -= 1
//motion_add(180,4)
}
if turn_value > 315 {
clockwise = true
}
if turn_value < 235 {
clockwise = false
}
turn_speed += sin(turn_value/2)*2;
motion_add(0,turn_speed)
Is there a better solution, or have I just made a stupid mistake?
Any help is appreciated, if more info is needed it will be provided.
To do this, I made a car object in the middle of the screen and tried to create the illusion of the car moving by making everything except the car itself move.
The tire tracks object works perfectly, like this:
direction = obj_player_car.image_angle + 180
speed = global.car_speed[global.current_car] + global.current_gear
The Problem:
I am trying to add enemy cars driving in all sorts of directions, while still maintaining the illusion.
Firstly, I tried adding a small car that drives 'south'. I wanted it to turn left and right.
I successfully made it drive 'south' while maintaining the illusion, like this:
speed = 10
image_angle = 270
direction = 270
motion_add(obj_player_car.image_angle + 180,global.car_speed[global.current_car]+ global.current_gear)
BUT when I tried adding the turning a few different ways, anomalies occured.
This is my latest attempt, which doesn't work.
if clockwise = false {
turn_value += 1
// motion_add(0,4)
} else {
turn_value -= 1
//motion_add(180,4)
}
if turn_value > 315 {
clockwise = true
}
if turn_value < 235 {
clockwise = false
}
turn_speed += sin(turn_value/2)*2;
motion_add(0,turn_speed)
Is there a better solution, or have I just made a stupid mistake?
Any help is appreciated, if more info is needed it will be provided.