Computer Science Canada Help!!!!!!! |
Author: | Heated_1717 [ Thu Jan 20, 2011 5:39 pm ] |
Post subject: | Help!!!!!!! |
Cannot set up timer!!! var tim : int var counter : int := 0 var font2 := Font.New ("system:42") var font1 := Font.New ("system:32") var x2 : int := maxx var y2 : int var x3 : int := maxx var y3 : int var x4 : int := maxx var y4 : int var x5 : int := maxx var y5 : int var x6 : int := maxx var y6 : int var x, y : int var starX : int var starY : int var c : int var chars : array char of boolean var man : int := Pic.FileNew ("guy1.jpg") var count : int count := 0 x := 100 y := 100 %Ready Set Go Font.Draw ("Ready", 250, 300, font1, black) delay (700) Font.Draw ("Set", 280, 230, font1, black) delay (700) cls Font.Draw ("GO!!", 260, 210, font2, black) delay (100) cls Font.Draw ("GO!!", 260, 210, font2, yellow) delay (100) cls Font.Draw ("GO!!", 260, 210, font2, black) delay (100) cls Font.Draw ("GO!!", 260, 210, font2, yellow) delay (100) cls Font.Draw ("GO!!", 260, 210, font2, black) delay (100) cls Font.Draw ("GO!!", 260, 210, font2, yellow) delay (500) cls Font.Draw ("GO!!", 260, 210, font2, black) cls loop y2 := Rand.Int (0, maxy - 20) y3 := Rand.Int (0, maxy - 20) y4 := Rand.Int (0, maxy - 20) y5 := Rand.Int (0, maxy - 20) y6 := Rand.Int (0, maxy - 20) %Control Keys loop View.Set ("offscreenonly") Input.KeyDown (chars) if chars (KEY_UP_ARROW) then y += 2 end if if chars (KEY_RIGHT_ARROW) then x := x + 3 end if if chars (KEY_LEFT_ARROW) then x -= 2 end if if chars (KEY_DOWN_ARROW) then y := y - 2 end if Pic.Draw (man, x, y, picCopy) delay (2) cls if x < -16 then x := -16 end if if x > 555 then x := 555 end if if y > 316 then y := 316 end if if y < -16 then y := -16 end if %Moving Stars x2 -= 5 Pic.Draw (man, x, y, picCopy) drawfillstar (x2, y2, x2 + 20, y2 + 20, 14) drawstar (x2, y2, x2 + 20, y2 + 20, black) delay (2) if x2 < 0 then x2 := 640 exit end if x3 -= 5 Pic.Draw (man, x, y, picCopy) drawfillstar (x3, y3, x3 + 20, y3 + 20, 14) drawstar (x3, y3, x3 + 20, y3 + 20, black) delay (2) if x3 < 0 then x3 := 640 exit end if x4 -= 5 Pic.Draw (man, x, y, picCopy) drawfillstar (x4, y4, x4 + 20, y4 + 20, 14) drawstar (x4, y4, x4 + 20, y4 + 20, black) delay (2) if x4 < 0 then x4 := 640 exit end if x5 -= 5 View.Update Pic.Draw (man, x, y, picCopy) drawfillstar (x5, y5, x5 + 20, y5 + 20, 14) drawstar (x5, y5, x5 + 20, y5 + 20, black) delay (2) if x5 < 0 then x5 := 640 exit end if x6 -= 5 View.Update Pic.Draw (man, x, y, picCopy) drawfillstar (x6, y6, x6 + 20, y6 + 20, 14) drawstar (x6, y6, x6 + 20, y6 + 20, black) delay (2) if x6 < 0 then x6 := 640 exit end if end loop end loop |
Author: | Tony [ Thu Jan 20, 2011 5:55 pm ] |
Post subject: | RE:Help!!!!!!! |
Better title and explanation of the problem plz. That's what the template was there for. |
Author: | Heated_1717 [ Thu Jan 20, 2011 6:01 pm ] |
Post subject: | RE:Help!!!!!!! |
Sorry... I'm trying to create a game where the object of the game is for the figure (person) to avoid the "stars". If the "stars" hit the figure (person) then the timer will stop and it should say "you lose". I have two problems...I cannot set up a timer and the stars don't move at the same time. |
Author: | Insectoid [ Thu Jan 20, 2011 6:06 pm ] |
Post subject: | RE:Help!!!!!!! |
They don't need to run at the same time, they just have to look like they do. |
Author: | Heated_1717 [ Thu Jan 20, 2011 6:12 pm ] |
Post subject: | RE:Help!!!!!!! |
Oh...makes sense. Can you help me create a timer...have no clue what I am doing. |
Author: | Tony [ Thu Jan 20, 2011 6:24 pm ] |
Post subject: | RE:Help!!!!!!! |
you could read about Time.Elapsed |
Author: | Heated_1717 [ Thu Jan 20, 2011 6:42 pm ] |
Post subject: | RE:Help!!!!!!! |
soo, how do I make it so when the player hits a star the game ends? |
Author: | Tony [ Thu Jan 20, 2011 8:13 pm ] |
Post subject: | RE:Help!!!!!!! |
well, what do you think? |