GrimGreg
|
Posted: Thu Feb 22, 2007 8:07 pm Post subject: Shooting game ---> cursor not disappearing |
|
|
okay, i have a problem, i cant get the cursor to move without leaving a big long trail of white behind it. it moves fine with the mouse, but it doesnt erase the old picture behind it when i move. know what i mean? lol
anyways here it is in code...
[CODE]
import GUI
setscreen ( "graphics:1010;660")
var bush:int
var bullet:int
var picid:int
var crosshairs:int
var ballx, bally : int := 200
picid := Pic.FileNew ("gearsback.jpg")
bullet := Pic.FileNew ("ammo.jpg")
crosshairs := Pic.FileNew ("crosshairs.bmp")
var backgroundPictureWidth : int
backgroundPictureWidth := Pic.Width (picid)
var backgroundPictureHeight: int
backgroundPictureHeight := Pic.Height (picid)
var backgroundPictureX : int
backgroundPictureX:= (backgroundPictureWidth - (maxx + 1)) div 2
var backgroundPictureY: int
backgroundPictureY:= (backgroundPictureHeight - (maxy + 1)) div 2
var bushwid, bushtall:int
var bulletwid, bullettall:int
bush := Pic.FileNew ("bush.jpg")
bushwid := Pic.Width (bush)
bushtall:=Pic.Height (bush)
bulletwid := Pic.Width (bullet)
bullettall := Pic.Height (bullet)
process bond
Music.PlayFile ("Bond.mp3")
end bond
procedure shot
Music.PlayFile ("gunshot.wav")
end shot
procedure glass
Music.PlayFile ("glass.wav")
end glass
procedure comeon
Music.PlayFile ("comeon.wav")
end comeon
var x, y : int
x:=555
y:=330
var font1, font2, font3, font4 : int
font1 := Font.New ("serif:12")
font2 := Font.New ("sans serif:18:bold")
font3 := Font.New ("mono:9")
font4 := Font.New ("Palatino:24:Bold,Italic")
assert font1 > 0 and font2 > 0 and font3 > 0 and font4 > 0
process trogdor
Music.PlayFile ("Trogdor.mp3")
end trogdor
%Procedure of Trogdor Music
procedure game
Music.PlayFileStop
fork bond
cls
var x, y, b : int
Pic.Draw (picid, -backgroundPictureX, -backgroundPictureY, picUnderMerge)
loop
setscreen ("offscreenonly")
View.Update
drawfillbox (830, 0, 1010, 300, black)
Pic.Draw (bullet, bulletwid, bullettall, picMerge)
mousewhere (x, y, b)
if b = 0 then
else
shot
end if
Pic.Draw (crosshairs, ballx, bally, picMerge)
if b = 0 and y > bally then
bally := bally + 20
end if
if b = 0 and y < bally then
bally := bally - 20
end if
if b = 0 and x > ballx then
ballx := ballx + 20
end if
if b = 0 and x < ballx then
ballx := ballx - 20
end if
end loop
end game
procedure controls
Font.Draw ("Use the mouse to move the cursor around the screen", x-300, y+50, font2, black)
Font.Draw ("Click to shoot a bush", x-200, y, font2, black)
end controls
fork trogdor
Font.Draw ("WHACK-A-BUSH", x-135, y+200, font2, red)
var button1:int:=GUI.CreateButton(x-80,y-100,0,"Controls",controls)
var button2:int:=GUI.CreateButton(x-75,y-75,0,"Start!", game)
Pic.Draw (bush, bushwid, bushtall, picMerge)
loop
exit when GUI.ProcessEvent
end loop
[CODE]
thanks guys |
|
|