need help in disapearing the rock from screen
Author |
Message |
snaz
|
Posted: Tue May 18, 2004 8:35 pm Post subject: need help in disapearing the rock from screen |
|
|
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
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
Delos
|
Posted: Tue May 18, 2004 8:53 pm Post subject: (No subject) |
|
|
Ok...
1) Use [code] tags.
2) Nice code...but we don't have the pics you speak of in it. Zip everything together then post that.
3) Don't post all your code, just your problem areas.
4) Don't use processes for a programme this simple.
5) Please don't use processes.
6) Many people here have computers several hundred times faster and better than those that you use at your school/home...thus being you will most likely need Time.Delay()s in your prog...
Fix and then repost...you'll get better answers quicker.
|
|
|
|
|
|
snaz
|
Posted: Tue May 18, 2004 10:09 pm Post subject: attach all the pics with codes |
|
|
i attach all the pics and i already posted the game codes, one more question where can i put my background in my program thanks for helping
Description: |
|
Filesize: |
1.85 KB |
Viewed: |
6056 Time(s) |
|
Description: |
|
Filesize: |
2.96 KB |
Viewed: |
6054 Time(s) |
|
Description: |
|
Filesize: |
2.96 KB |
Viewed: |
6054 Time(s) |
|
|
|
|
|
|
|
snaz
|
Posted: Wed May 19, 2004 9:27 pm Post subject: y is no one giving the response |
|
|
hi guys i posted my problem why is some one is not helping me, plz someone help me, i am not posting my problen cus i alreadt posted adn also i posted all the pic
|
|
|
|
|
|
LiquidDragon
|
Posted: Thu May 20, 2004 2:39 pm Post subject: (No subject) |
|
|
your still missing pictures
|
|
|
|
|
|
snaz
|
Posted: Thu May 20, 2004 5:23 pm Post subject: posted my pics |
|
|
hi, i posted my pic, plz some one hlp me
Description: |
|
Filesize: |
1.85 KB |
Viewed: |
6050 Time(s) |
|
Description: |
|
Filesize: |
2.96 KB |
Viewed: |
6048 Time(s) |
|
Description: |
|
Filesize: |
2.13 KB |
Viewed: |
6050 Time(s) |
|
|
|
|
|
|
|
snaz
|
Posted: Thu May 20, 2004 5:37 pm Post subject: POsted correct pics |
|
|
hi, sorry my bad i didn't attach the pics , but this time i did. i ma not posting my problem again cus i already posted in,. plz help me
Description: |
|
Download |
Filename: |
pics of my game.zip |
Filesize: |
5.85 KB |
Downloaded: |
193 Time(s) |
|
|
|
|
|
|
snaz
|
Posted: Thu May 20, 2004 5:48 pm Post subject: (No subject) |
|
|
hi, this time i posted all my pic of my game and i already posted the codes and my problem, plz help me
Description: |
|
Download |
Filename: |
pics of my game.zip |
Filesize: |
5.85 KB |
Downloaded: |
210 Time(s) |
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
snaz
|
Posted: Thu May 20, 2004 5:51 pm Post subject: (No subject) |
|
|
hi, this time i posted all my pic of my game and i already posted the codes and my problem, plz help me
Description: |
|
Download |
Filename: |
pics of my game.zip |
Filesize: |
5.85 KB |
Downloaded: |
209 Time(s) |
|
|
|
|
|
|
snaz
|
Posted: Thu May 20, 2004 5:55 pm Post subject: (No subject) |
|
|
sorry, i tried 3 times but i cna't post the pics i don't know y. just write down the codes adn i already posted the codes and my problem, plz help me
|
|
|
|
|
|
snaz
|
|
|
|
|
snaz
|
Posted: Fri May 21, 2004 3:55 pm Post subject: PLease some one help me |
|
|
i posted my prrblem two days ago but no one is helping me, pls some one hlep adn i am not posting my problem cus i already posted it
|
|
|
|
|
|
|
|