Hello. I am trying to make a simple car game, but I cant seem to fix this problem.
AddVirtualButton(1,200,400,80)
AddVirtualButton(2,600,400,80)
do
x# = GetSpriteX ( car )
y# = GetSpriteY ( car )
carspeedmultiplier = 2
SetSpritePosition(car,x# - carspeedmultiplier ,y# - caranglerotate#)
if GetVirtualButtonState(1) = 1
carangle = carangle - 2
SetSpriteAngle(car,carangle)
caranglerotate# = caranglerotate# - 0.2
endif
if GetVirtualButtonState(2) = 1
carangle = carangle + 2
SetSpriteAngle(car,carangle)
caranglerotate# = caranglerotate# + 0.2
endif
if caranglerotate# > 1.3
caranglerotate# = 1.3
endif
At the start, the sprite moves fine. When I turn it, it goes in the correct direction, and then completely breaks lol.
Basically I have 2 buttons. The first one changes direction, and the second one also changes direction but in the other way. How can I make it so that the two buttons change the direction and the car goes in the direction that it is facing? I tried my best in the above code but everything I ever make always breaks haha
Thanks guys for any help you can offer