Hello Everyone.
I am trying to make my player(bitmap imaged sprite) able to move in a " direction" after rotating however far left or right(with the left and right arrow keys). I currently have player moving on X and Y with arrow keys, if i hit up and right together he will move diagonally which is fairly good but not exactly what I want. here is the current code for player1's input
My problem begins with making a varible float for "direction " then using " direction" in SetRotation using left or right arrows to add or subtract from "direction" this causes my player and all objects displayed to rotate, even my text showing memalloced() and memusage() and my tiled map. Been trying to figure this out for days and have searched far and wide on the web for some examples to give me a clue.
What I eventually want is to have my player rotate on left and right arrows and then move forward or backwards in the current direction of " direction " and then if I combine a left or right arrow and another key to then strafe left or right + or - 90 degrees from the current facing direction. I think I can handle the strafing part IF I could ever figure out how to move him as described, really gets frustrating being a newbie to this.
Any help is greatly appreciated!
P.S. The code example is what I started with , what I tried was too ugly to be seen in public , plus I scraped it and switched it back to the code you see now.
I am trying to make my player(bitmap imaged sprite) able to move in a " direction" after rotating however far left or right(with the left and right arrow keys). I currently have player moving on X and Y with arrow keys, if i hit up and right together he will move diagonally which is fairly good but not exactly what I want. here is the current code for player1's input
Function Player1Input() If KeyDown(Key_Left) player1X:- RunSpeed If KeyDown(Key_Right)player1X:+ RunSpeed If KeyDown(Key_Down) player1Y:+ RunSpeed If KeyDown(Key_Up) player1Y:- RunSpeed If KeyHit(KEY_MOUSELEFT) Local bullet:TFire = New TFire bullet.x = player1X bullet.y = player1Y bullet.image = bulletImage ListAddLast bulletList, bullet End If End Function
My problem begins with making a varible float for "direction " then using " direction" in SetRotation using left or right arrows to add or subtract from "direction" this causes my player and all objects displayed to rotate, even my text showing memalloced() and memusage() and my tiled map. Been trying to figure this out for days and have searched far and wide on the web for some examples to give me a clue.
What I eventually want is to have my player rotate on left and right arrows and then move forward or backwards in the current direction of " direction " and then if I combine a left or right arrow and another key to then strafe left or right + or - 90 degrees from the current facing direction. I think I can handle the strafing part IF I could ever figure out how to move him as described, really gets frustrating being a newbie to this.
Any help is greatly appreciated!
P.S. The code example is what I started with , what I tried was too ugly to be seen in public , plus I scraped it and switched it back to the code you see now.