please some one hlep me

Computer builds, hardware and software discussion or troubleshooting, including peripherals. Essentially a general place to talk about desktop computers.
Locked
Anonymous

please some one hlep me

Post by Anonymous »

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:2335, old post ID:19771
User avatar
Red Squirrel
Posts: 29214
Joined: Wed Dec 18, 2002 12:14 am
Location: Northern Ontario
Contact:

please some one hlep me

Post by Red Squirrel »

You already posted this here so I will close this. ;)

Unfortunatly we don't have lot of programmers here. I do some programming my php is my strongest, not C++ and turing which we seem to get lot of questions.

I did do some open gl before, and you could set it so if the shape is so close the the camera, it just disapears, you might want to look into that and see how it's done with what you're using.

Archived topic from Iceteks, old topic ID:2335, old post ID:19772
Honk if you love Jesus, text if you want to meet Him!
Locked