
-----------------------------------
GOLDEN WEAPON
Wed May 21, 2003 4:26 pm

MAKING A GAME
-----------------------------------
Ok, I am in my first year of programming and my friend and I are way ahead of the class. For our final project we need to make a game with turing. We decided to make a game kind of like and old school space shooter where you shoot at the lines of enemies coming at you from one side of the screen. We started it on the weekend and everything have benn running pretty smoothly except one thing. Whenever we move our jets, the image of the jet at the x,y it was just at stays there once we move and it leavels a trail of the jets behind itself. We tried having a cls after the Input.KeyDown but it makes the screen flash as you play and it takes a few seconds to reload the background each time. So I guess my question is how do I clear the extra jets away without using a cls command?

Mod Edit: How about a better title next time? More poelop will probley help you then and sooner. You are lucky Asok did not locke this  :wink: 

-----------------------------------
Catalyst
Wed May 21, 2003 4:48 pm


-----------------------------------
if u have turing 4 (i think u do since you have (Input.KeysDown)


at the top of ur prog put
View.Set ("offscreenonly")


then in the loop

View.Update
cls

-----------------------------------
naoki
Wed May 21, 2003 4:58 pm


-----------------------------------
also when using the Pic.Draw or Pic.ScreenLoad commands use picMerge as your method of displaying the picture.

As well, you won't need picXor after loading the image (a mistake of mine early on)

Oh yeah, picMerge only works if your background of your picture is white, so make that happen beforehand.

-----------------------------------
GOLDEN WEAPON
Wed May 21, 2003 5:06 pm


-----------------------------------
I also have the background image as the Clouds.bmp from windows (some of you might know it). So would it be ok to use picUnderMerge for that image?

-----------------------------------
GOLDEN WEAPON
Wed May 21, 2003 5:18 pm


-----------------------------------
Ok, it's even worse now. When I start the program, the screen goes totally white. When I try to close the window, it comes up correctly, but when I try to move a jet, the screen goes totally black! HELP!!



var x : int := 100
var y : int := 410
var x2 : int := 100
var y2 : int := 70
var jet1nofire : int
var jet1fire : int
var jet2nofire : int
var jet2fire : int
var Clouds : int
var Clouds2 : int
var Clouds3 : int
var Clouds4 : int
var skywidth, skyheight : int := 0
var skywidth2, skyheight2 : int := 0
var skywidth3, skyheight3 : int := 0
var skywidth4, skyheight4 : int := 0
var skyx, skyy : int := 0
var skyxedge : int := 640
var skyyedge : int := 480
Clouds := Pic.FileNew ("Clouds.bmp")
Clouds2 := Pic.FileNew ("Clouds.bmp")
Clouds2 := Pic.Mirror (Clouds2)
Clouds3 := Pic.FileNew ("Clouds.bmp")
Clouds3 := Pic.Flip (Clouds3)
Clouds4 := Pic.FileNew ("Clouds.bmp")
Clouds4 := Pic.Flip (Clouds4)
Clouds4 := Pic.Mirror (Clouds4)
jet1nofire := Pic.FileNew ("jet1nofire.bmp")
Pic.SetTransparentColour (jet1nofire, white)
jet1fire := Pic.FileNew ("jet1fire.bmp")
Pic.SetTransparentColour (jet1fire, white)
jet2nofire := Pic.FileNew ("jet2nofire.bmp")
Pic.SetTransparentColour (jet2nofire, white)
jet2fire := Pic.FileNew ("jet2fire.bmp")
Pic.SetTransparentColour (jet2fire, white)
var jethealth1 : real := 100
var jethealth2 : real := 100
var score1 : int := 0
var score2 : int := 0
var bullets : int
var bullets2 : int
const uparrow : char := chr (200)
const leftarrow : char := chr (203)
const rightarrow : char := chr (205)
const downarrow : char := chr (208)
const ctrl : char := chr (181)
const w : char := chr (119)
const a : char := chr (97)
const d : char := chr (100)
const s : char := chr (115)
const f : char := chr (102)
var choice : string
var keys : array char of boolean

View.Set ("offscreenonly")
setscreen ("graphics:max;max,noecho,offscreenonly,nocursor,nobuttonbar")

procedure drawscreen
    skywidth := Pic.Width (Clouds)
    skyheight := Pic.Height (Clouds)
    skywidth2 := Pic.Width (Clouds2)
    skyheight2 := Pic.Height (Clouds2)
    skywidth3 := Pic.Width (Clouds3)
    skyheight3 := Pic.Height (Clouds3)
    skywidth4 := Pic.Width (Clouds4)
    skyheight4 := Pic.Height (Clouds4)
    Pic.Draw (Clouds, -skyx, -skyy, picUnderMerge)
    Pic.Draw (Clouds2, skyxedge, -skyy, picUnderMerge)
    Pic.Draw (Clouds3, -skyx, skyyedge, picUnderMerge)
    Pic.Draw (Clouds4, skyxedge, skyyedge, picUnderMerge)
    locate (1, 1)
    put "Player 1:", "" : 2, "Health: ", jethealth1 ..
    put " ", "Score: ", score1
    put "Player 2:", "" : 2, "Health: ", jethealth2 ..
    put " ", "Score: ", score2
end drawscreen

colourback (black)
colour (brightred)

drawscreen
colourback (black)
colour (brightred)

Pic.Draw (jet1nofire, x, y, picMerge)
Pic.Draw (jet2nofire, x2, y2, picMerge)
delay (2000)
loop
    exit when jethealth1 