Computer Science Canada How to add a background to menu and game |
Author: | Pancakes24564 [ Wed May 15, 2013 5:00 pm ] | ||
Post subject: | How to add a background to menu and game | ||
What is it you are trying to achieve? <Replace all the <> with your answers/code and remove the <>> What is the problem you are having? <I am having trouble finding out how to put a background for my menu screen and game.> Describe what you have tried to solve this problem <Answer Here> Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) <import GUI procedure PlayGame cls put "credits: an orange." end PlayGame View.Set ("graphics:300;200,nobuttonbar") var draw : int := GUI.CreateButtonFull (200, 10, 0, "Quit", PlayGame, 0, '^D', true) var quitBtn : int := GUI.CreateButton (50, 10, 0, "Play", GUI.Quit) loop exit when GUI.ProcessEvent end loop cls setscreen ("offscreenonly") var picID : int := Pic.FileNew ("spaceship.bmp") var x, y, button : int loop %needs to be in a loop to keep on reading mouse data Mouse.Where (x, y, button) %code to find data on mouse %locatexy (x, y) %locate the text to the same line as x&y %check to see if button is hit %if button > 0 then %locatexy (maxx div 2, maxy div 2) Pic.Draw (picID, x, y, picCopy) View.Update delay (2) cls end loop>
Please specify what version of Turing you are using <Answer Here> |
Author: | Nathan4102 [ Wed May 15, 2013 5:01 pm ] |
Post subject: | RE:How to add a background to menu and game |
You need to draw your background before you draw your foreground, and then repeat drawing both of them in a loop. |