Hi guys, this is my first time that I am posting here. I am making the asteroid game and I am almost done. I need help to disappear the rock from screen when I shoot with my gun, and also how can I do this by chance if rock hit my plane, then the plan crash and after2 second, new ship appear. Some one plz help cus this is my first and last assignment in Turing.
here are the codes of my game
View.Set ("graphics:800;600,offscreenonly")
var shipUpper : int := Pic.FileNew ("gun.jpg")
var bulletUpper : int := Pic.FileNew ("bullet.jpg")
var rock : int := Pic.FileNew ("rock.jpg")
Pic.SetTransparentColour (rock, black)
var shipDown : int := Pic.Rotate (shipUpper, 180, -1, -1) % Rotate for down arrow
var shipLeft : int := Pic.Rotate (shipUpper, 90, -1, -1) % Rotate for left arrow
var shipRight : int := Pic.Rotate (shipUpper, 270, -1, -1) % Rotate for right arrow
var bulletDown : int := Pic.Rotate (bulletUpper, 180, -1, -1)
var bulletLeft : int := Pic.Rotate (bulletUpper, 90, -1, -1)
var bulletRight : int := Pic.Rotate (bulletUpper, 270, -1, -1)
var x1, y1, x2, x3, y4, bulletX, bulletY, score, life, rockX, rockY : int := 0
var keys : array char of boolean % they key currently being pressed
var KEY_SPACEBAR : char := chr (32)
var UP_ARROW : char := chr (200)
var LEFT_ARROW : char := chr (203)
var RIGHT_ARROW : char := chr (205)
var DOWN_ARROW : char := chr (208)
life := 20
rockX := 20
rockY := 700
process rockDropping
loop
Pic.Draw (rock, rockX, rockY, picXor)
View.Update
Pic.Draw (rock, rockX, rockY, picXor)
rockY := rockY - 10
if rockY <= 0 then
randint (rockX, 20, 500)
randint (rockY, 700, 900)
rockY := rockY - 10
end if
end loop
end rockDropping
fork rockDropping
loop
colorback (black)
Input.KeyDown (keys)
if keys (UP_ARROW) then
cls
Pic.Draw (shipUpper, x2 + x3, y1 + y4, picMerge)
y1 := y1 + 10
if keys (KEY_SPACEBAR) then
Pic.Draw (bulletUpper, x2 + x3 + 34, y1 + y4 + 120 + bulletY, picMerge)
bulletY := bulletY + 10
else
bulletY := 0
end if
elsif keys (LEFT_ARROW) then
cls
Pic.Draw (shipLeft, x2 + x3, y1 + y4, picMerge)
x2 := x2 - 10
if keys (KEY_SPACEBAR) then
Pic.Draw (bulletLeft, x2 + x3 - 40, y1 + y4 + 35 - bulletX, picMerge)
bulletX := bulletX - 10
else
bulletX := 0
end if
elsif keys (DOWN_ARROW) then
cls
Pic.Draw (shipDown, x2 + x3, y4 + y1, picMerge)
y4 := y4 - 10
if keys (KEY_SPACEBAR) then
Pic.Draw (bulletDown, x2 + x3 + 34, y1 + y4 - 40 + bulletY, picMerge)
bulletY := bulletY - 7
else
bulletY := 0
end if
elsif keys (RIGHT_ARROW) then
cls
Pic.Draw (shipRight, x3 + x2, y1 + y4, picMerge)
x3 := x3 + 10
if keys (KEY_SPACEBAR) then
Pic.Draw (bulletRight, x2 + x3 + 131, y1 + y4 + 35 + bulletX, picMerge)
bulletX := bulletX + 10
else
bulletX := 0
end if
end if
if y1 + y4 >= 300 then
cls
Pic.Draw (shipDown, x2 + x3, y4 + y1, picMerge)
y1 := y1 - 10
elsif y4 + y1 <= 0 then
cls
Pic.Draw (shipUpper, x2 + x3, y1 + y4, picMerge)
y4 := y4 + 10
elsif x2 + x3 < 0 then
cls
Pic.Draw (shipRight, x3 + x2, y1 + y4, picMerge)
x2 := x2 + 10
elsif x3 + x2 >= 500 then
cls
Pic.Draw (shipLeft, x2 + x3, y1 + y4, picMerge)
x3 := x3 - 10
end if
locate (33, 87)
color (white)
put score, " : Score"
locate (35, 87)
color (white)
put life, " : Life"
View.Update
end loop
Archived topic from Iceteks, old topic ID:2332, old post ID:19758
help need to disapear the rock from screen
- Red Squirrel
- Posts: 29209
- Joined: Wed Dec 18, 2002 12:14 am
- Location: Northern Ontario
- Contact:
help need to disapear the rock from screen
Welcome to the forum! I can't help you, but I hope someone else can.
Archived topic from Iceteks, old topic ID:2332, old post ID:19759
Archived topic from Iceteks, old topic ID:2332, old post ID:19759
Honk if you love Jesus, text if you want to meet Him!
- rovingcowboy
- Posts: 1504
- Joined: Wed Dec 18, 2002 10:14 pm
help need to disapear the rock from screen
sorry but this is way beyond me??
try
http://help.lockergnome.com
there are over 12,000 members there and lots do gaming and programing
good luck
Archived topic from Iceteks, old topic ID:2332, old post ID:19776
roving cowboy/ keith