Computer Science Canada

ufo mobile

Author:  dying to live [ Tue Nov 02, 2004 9:48 am ]
Post subject:  ufo mobile

ok so im done with my motion of the space craft all i need is a back ground like a town or sumthing but when i try and make it all that happens is that the screen will flash and then my ufo will be there on a blank screen, im not sure whats wrong with it but can anyone help me make a back ground for my space ship to fly around in??? thanks!

here is what i got so far...

code:

var x,y : int
x:=100
y:=100
var chars : array char of boolean
var ufo :int
var ufo2 :int

%draws the ufo
drawfillbox(15,15,50,20,red)
drawfillbox(20,20,45,15,9)
drawfillbox(20,20,45,25,8)
drawline(15,5,23,15,7)
drawline(23,15,43,15,7)
drawline(43,15,50,5,7)
drawline(50,5,15,5,7)
drawfill(35,10,yellow,7)
drawbox(15,15,50,20,7)
drawbox(20,15,45,20,7)
drawbox(20,20,45,25,7)



%takes the picture of the ufo
ufo := Pic.New (15,5,50,25)


loop
Input.KeyDown (chars)

Pic.Draw (ufo, x, y, picCopy)
    if chars (KEY_UP_ARROW) then
    y:=y+5
    end if
   
    if chars (KEY_RIGHT_ARROW) then
    x:=x+5
    end if
   
    if chars (KEY_LEFT_ARROW) then
    x:=x-5
    end if
   
    if chars (KEY_DOWN_ARROW) then
    y:=y-5
    end if
           
            drawbox(x,y,x,y,red)
            delay(50)
cls
end loop

Author:  Tony [ Tue Nov 02, 2004 12:36 pm ]
Post subject: 

looks like you forgot to include drawing the background in the code you posted...
code:

loop
     input
     draw background
     draw ufo
end loop


: