Computer Science Canada turing game help |
Author: | tokadoka [ Sun Jan 20, 2008 4:14 pm ] |
Post subject: | turing game help |
looking to get some help and advice for my game, any comments would help thanks var cheese, cheese1, cheese2, cheese3, cheese4, cheese5, mouse, kitchen, x, h, y, z, w, v, mousehead, gamedone : int var key : array char of boolean var mousetounge : int setscreen ("graphics:600;400, nobuttonbar") % the title page of the game where you select the options of what you want to do kitchen := Pic.FileNew ("kitchen_floor.bmp") kitchen := Pic.Scale (kitchen, 600, 400) Pic.Draw (kitchen, 0, 0, picUnderMerge) cheese := Pic.FileNew ("cheese1.gif") cheese := Pic.Scale (cheese, 200, 200) Pic.Draw (cheese, maxx div 2 - 270, maxy div 2, picMerge) mouse := Pic.FileNew ("mouse.bmp") mouse := Pic.Scale (mouse, 600, 500) Pic.Draw (mouse, maxx div 2 - 100, maxy div 2 - 300, picMerge) var myfont : int myfont := Font.New ("Showcard Gothic:24:bold") Font.Draw ("1. Start Game", 10, 150, myfont, brightred) Font.Draw ("2. Instructions", 10, 110, myfont, brightpurple) Font.Draw ("3. Exit", 10, 70, myfont, brightblue) drawfillbox (32, 48, 62, 63, 0) locate (22, 5) get x if x = 1 then cls % numbers counting doown letting you know when its going to start Font.Draw ("Game Starting in...", maxx div 2 - 200, maxy div 2, myfont, brightred) delay (1000) Font.Draw ("Game Starting in...", maxx div 2 - 200, maxy div 2, myfont, 0) Font.Draw ("3", maxx div 2, maxy div 2, myfont, brightred) delay (1000) Font.Draw ("3", maxx div 2, maxy div 2, myfont, 0) Font.Draw ("2", maxx div 2, maxy div 2, myfont, brightred) delay (1000) Font.Draw ("2", maxx div 2, maxy div 2, myfont, 0) Font.Draw ("1", maxx div 2, maxy div 2, myfont, brightred) delay (1000) Font.Draw ("1", maxx div 2, maxy div 2, myfont, 0) Font.Draw ("GO!", maxx div 2, maxy div 2, myfont, brightred) delay (800) Font.Draw ("GO!", maxx div 2, maxy div 2, myfont, 0) % the background of the game kitchen := Pic.FileNew ("kitchen_floor.bmp") kitchen := Pic.Scale (kitchen, maxx, maxy) kitchen := Sprite.New (kitchen) Sprite.SetPosition (kitchen, maxx div 2, maxy div 2, true) Sprite.Show (kitchen) % the mouse moving back on fourth mousehead := Pic.FileNew ("mousehead.bmp") mousehead := Pic.Scale (mousehead, 280, 70) mousehead := Sprite.New (mousehead) Sprite.Show (mousehead) View.Set ("nooffscreenonly") loop randint (h, 0, 550) randint (y, 0, 550) randint (z, 0, 550) randint (w, 0, 550) randint (v, 0, 550) cheese1 := Pic.FileNew ("cheese1.gif") cheese1 := Pic.Scale (cheese1, 40, 40) cheese1 := Sprite.New (cheese1) Sprite.SetPosition (cheese1, h, 270, false) Sprite.Show (cheese1) cheese2 := Pic.FileNew ("cheese2.gif") cheese2 := Pic.Scale (cheese2, 75, 75) cheese2 := Sprite.New (cheese2) Sprite.SetPosition (cheese2, y, 200, false) Sprite.Show (cheese2) cheese3 := Pic.FileNew ("cheese3.gif") cheese3 := Pic.Scale (cheese3, 50, 50) cheese3 := Sprite.New (cheese3) Sprite.SetPosition (cheese3, z, 120, false) Sprite.Show (cheese3) cheese4 := Pic.FileNew ("cheese4.gif") cheese4 := Pic.Scale (cheese4, 75, 75) cheese4 := Sprite.New (cheese4) Sprite.SetPosition (cheese4, w, 50, false) Sprite.Show (cheese4) cheese5 := Pic.FileNew ("cheese5.gif") cheese5 := Pic.Scale (cheese5, 25, 25) cheese5 := Sprite.New (cheese5) Sprite.SetPosition (cheese5, v, 30, false) Sprite.Show (cheese5) loop for decreasing i : maxx - 150 .. -130 Sprite.SetPosition (mousehead, i, maxy - 102, false) delay (3) Input.KeyDown (key) if key (KEY_DOWN_ARROW) then for counter : 1 .. maxy - 102 by 50 mousetounge := Pic.FileNew ("mousetounge.bmp") mousetounge := Pic.Scale (mousetounge, 100, counter) mousetounge := Sprite.New (mousetounge) Sprite.SetPosition (mousetounge, i + 160, maxy - (counter div 2) - 62, true) Sprite.Show (mousetounge) View.Update delay (25) Sprite.Hide (mousetounge) end for end if end for for i : -130 .. maxx - 150 Sprite.SetPosition (mousehead, i, maxy - 102, false) delay (3) Input.KeyDown (key) if key (KEY_DOWN_ARROW) then for counter : 1 .. maxy - 102 by 50 mousetounge := Pic.FileNew ("mousetounge.bmp") mousetounge := Pic.Scale (mousetounge, 100, counter) mousetounge := Sprite.New (mousetounge) Sprite.SetPosition (mousetounge, i + 160, maxy - (counter div 2) - 62, true) Sprite.Show (mousetounge) delay (25) Sprite.Hide (mousetounge) end for end if end for end loop exit when gamedone = 100 end loop end if at the moment im working on having the mouse tongue go down and pick up cheese, but im not aware of how to do so, i also need a way to calculate points gained and lost, like i said, any pointers would be great, thanks |
Author: | Sean [ Sun Jan 20, 2008 5:23 pm ] |
Post subject: | Re: turing game help |
For points you want a score variable and keep increasing when they get a cheese and decrease when they get hit, or hit a mouse trap if your looking to put that in. |
Author: | tokadoka [ Sun Jan 20, 2008 6:06 pm ] |
Post subject: | Re: turing game help |
ok cool, but that would be the next step, how do i make it so that the mousetounge, makes contact with the cheese/mousetrap? And pick up the cheese and take it back up to the mouth? thanks again for comments |
Author: | Sean [ Sun Jan 20, 2008 6:14 pm ] |
Post subject: | Re: turing game help |
I believe, correct me if I am wrong, but you need the picture x and y variables need to be the same as the tounge when you want it to pick up. Collision is detection is required. |
Author: | tokadoka [ Sun Jan 20, 2008 6:19 pm ] |
Post subject: | Re: turing game help |
how do i do the collision dection thing you are talking about? |
Author: | syntax_error [ Sun Jan 20, 2008 6:49 pm ] |
Post subject: | Re: turing game help |
next time search the turing tutorial area before asking questions if they dont answer your question then ask for more clarification here: magic |
Author: | tokadoka [ Sun Jan 20, 2008 8:49 pm ] |
Post subject: | Re: turing game help |
made some progress with this game, kind of getting the collision thing, but still needing some help..hers two parts of the game the first part, ofcourse my variables, trying to make it so when the claw comes down and makes contact with the cheese/mousetrap something will happen, right now as i run the game, im trying to test it so that when it makes contact with it, it will write good on my screen. Whats happening is that instead of only writing good when it acually makes contact with the cheese, it writes it anywhere. var cheese, cheese1, cheese2, cheese3, cheese4, cheese5, mouse, mousetrap, mousetrap1, mousetrap2, mousetrap3, kitchen, x, h, y, z, w, v, mousehead, gamedone : int var key : array char of boolean var mousetounge : int var c1_y1,c1_y2, c2_y2, c3_y2, c4_y2, c5_y2, c4_x2, c3_x2, c2_x2, c1_x2, c5_x2, c1_x1, c2_x1, c3_x1, c4_x1, c5_x1 : int c1_y2 := 270 c2_y2 := 200 c3_y2 := 120 c4_y2 := 50 c5_y2 := 30 c1_x2 := 70 c2_x2 := 375 c3_x2 := 100 c4_x2 := 495 c5_x2 := 90 c1_x1 := 30 c2_x1 := 300 c3_x1 := 50 c4_x1 := 420 c5_x1 := 180 loop for decreasing i : maxx - 150 .. -130 Sprite.SetPosition (mousehead, i, maxy - 102, false) delay (3) Input.KeyDown (key) if key (KEY_DOWN_ARROW) then for counter : 1 .. maxy - 102 by 50 mousetounge := Pic.FileNew ("mousetounge.bmp") mousetounge := Pic.Scale (mousetounge, 100, counter) mousetounge := Sprite.New (mousetounge) Sprite.SetPosition (mousetounge, i + 160, maxy - (counter div 2) - 62, true) Sprite.Show (mousetounge) if counter < c1_y2 and counter > c1_x1 and counter < c1_x2 then put " good" elsif counter < c2_y2 and counter > c2_x1 and counter < c2_x2 then put "good" elsif counter < c3_y2 and counter > c3_x1 and counter < c3_x2 then put "good" elsif counter < c4_y2 and counter > c4_x1 and counter < c4_x2 then put "good" |