
-----------------------------------
snaz
Sat May 22, 2004 8:39 pm

some one please help me in my game
-----------------------------------
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. i cna't post the pics cus i don't know how and one more question where do i put background in my game. i am using keyboard not mouse

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 = 300 then 
cls 
Pic.Draw (shipDown, x2 + x3, y4 + y1, picMerge) 
y1 := y1 - 10 
elsif y4 + y1 = 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 

-----------------------------------
Delta
Sat May 22, 2004 9:21 pm


-----------------------------------
I hope I don't sound rude by saying this. But you people piss me off, of course by you people I mean the type of person who expects help on their project when they haven't even posted the pictures! Hint : Learn how to post all required pieces of your project.

But anywho.

Just simply stop drawing the rock, stop moving the rock, and stop checking for collision with the rock. Simple.

use something like this.

If rock = "dead" then
else
%Move
%Draw
%Collision
end if

-----------------------------------
Paul
Sat May 22, 2004 9:25 pm


-----------------------------------
lol Delta, these ppl don't piss me off, they crack me up.
http://www.compsci.ca/v2/viewtopic.php?t=5049
