Computer Science Canada

Need Help!!

Author:  Fmaric007 [ Tue Jan 04, 2011 8:20 am ]
Post subject:  Need Help!!

What is it you are trying to achieve?

Timer for my game! -Need a code


my code for my game so far is

View.Set ("offscreenonly")

var background, backbround2, background3, background4, background5, background6, background7, background8, background9, background10, background11, background12, background13 : int
var Smiley : int
var level : int := 1
var counter : int := 35







background := Pic.FileNew ("backgroundSAXBERGGAME.bmp")

process scream
loop
Music.PlayFile ("scream.mp3")
exit
end loop
end scream

var scary : int
scary := Pic.FileNew ("scary.bmp")

Smiley := Pic.FileNew ("Smiley2.jpg")
var x, y : int
x := 100
y := 375
var char1 : array char of boolean



loop
%View.Set ("Smiley: 75;100")
Input.KeyDown (char1)
if char1 (KEY_UP_ARROW) then
y := y + 10
end if
if char1 (KEY_RIGHT_ARROW) then
x := x + 10
end if
if char1 (KEY_LEFT_ARROW) then
x := x - 10
end if
if char1 (KEY_DOWN_ARROW) then
y := y - 10
end if
if x < 0 then
x := 600
elsif x > 600 then
x := 0
elsif y < 0 then
y := 400
elsif y > 400 then
y := 0
end if
Pic.Draw (background, 20, maxy - 400, picCopy)
Draw.FillBox (310, 0, 370, 19, 5)
if whatdotcolor (x, y) = 7 then
put "Get out of Black!"


end if


if whatdotcolor (x, y) = 5 then
level := level + 1
x := 100
y := 375
if level = 1 then
background := Pic.FileNew ("backgroundSAXBERGGAME.bmp")
elsif level = 2 then
background := Pic.FileNew ("background2.bmp")
elsif level = 3 then
background := Pic.FileNew ("background3.bmp")


elsif level = 4 then
background := Pic.FileNew ("background4.bmp")

elsif level = 5 then
background := Pic.FileNew ("background5.bmp")

elsif level = 6 then
background := Pic.FileNew ("background6.bmp")

elsif level = 7 then
background := Pic.FileNew ("background7.bmp")
elsif level = 8 then
background := Pic.FileNew ("background8.bmp")
elsif level = 9 then
background := Pic.FileNew ("background9.bmp")
elsif level = 10 then
background := Pic.FileNew ("background10.bmp")
elsif level = 11 then
background := Pic.FileNew ("background11.bmp")
elsif level = 12 then
background := Pic.FileNew ("background12.bmp")
elsif level = 13 then
background := Pic.FileNew ("background13.bmp")
fork scream






end if
end if

if level = 13 then
counter := counter - 1
Pic.Draw (scary, 0, 0, picCopy)
if counter < 0 then
fork scream


end if
end if


Pic.Draw (Smiley, x, y, picCopy)

delay (35)
View.Update
cls
end loop







What is the problem you are having?
Whenever I add timer codes, they dont work

Describe what you have tried to solve this problem
Tried several codes



All i need is a code for my game (timer) THAT WORKS, much appreciated if u put it in my code aswell
Turing:





Please specify what version of Turing you are using
Turing

Author:  Tony [ Tue Jan 04, 2011 9:59 am ]
Post subject:  RE:Need Help!!

Time.Elapsed

Author:  Fmaric007 [ Wed Jan 05, 2011 9:34 am ]
Post subject:  RE:Need Help!!

that didnt help when i added that into the code.

Author:  Insectoid [ Wed Jan 05, 2011 9:59 am ]
Post subject:  RE:Need Help!!

Exactly how did you put it in your code? You can't just drop the command in anywhere, it has to be used correctly just like any other.


: