import GUI in "%oot/lib/GUI"
var amountOfImages : int
amountOfImages := 2
setscreen ("noecho")
setscreen ("nocursor")
var pic : array 1 .. amountOfImages of int
var keyPress : string (1)
var x, y : int := 0
var speed : int := 1
var s : int := 0
var r : int := 0
const pi := 3.14159
Pic.ScreenLoad ("tank2" + ".bmp", 0, 0, picCopy)
pic (1) := Pic.New (0, 0, 60, 60)
proc objTank (x, y, rotation, num : int)
var rotate : int := Pic.Rotate (pic (num), rotation, 30, 30 /* - rotation Center Point x,y*/)
Pic.Draw (rotate, x, y, picCopy)
end objTank
process move
loop
getch (keyPress)
end loop
end move
proc Movement
loop
objTank (100 + x, 100 + y, r, 1)
delay (50)
locate (1, 1)
put "Rotation: ", r
put "X:", x
put "Y:", y
if keyPress = KEY_UP_ARROW then
keyPress := ""
speed := speed - 2
end if
if keyPress = KEY_DOWN_ARROW then
keyPress := ""
speed := speed + 2
end if
if keyPress = KEY_RIGHT_ARROW then
keyPress := ""
r := r - 10
if r <= -360 then
r := 0
end if
end if
if keyPress = KEY_LEFT_ARROW then
keyPress := ""
r := r + 10
if r >= 360 then
r := 0
end if
end if
x := round (sin (r * (pi / 180)) * speed)
y := round (cos (r * (pi / 180)) * speed * -1)
end loop
end Movement
process rotation
keyPress := "0"
loop
Movement
end loop
end rotation
fork rotation
fork move
|