
-----------------------------------
dying to live
Thu Oct 28, 2004 9:27 am

background
-----------------------------------
can someone help me make a background for my animation/game thing. im trying to make a ufo fly above a town at night time when you press a direction. here is my code so far.

 
%kyle's ufo thing

var x,y : int 
x:=100 
y:=100 
var chars : array char of boolean 
var ufo :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



can anyone help me cuz when i use the "pic.new" and "pic.copy" command it takes away the background when i run it. :x

-----------------------------------
Delos
Thu Oct 28, 2004 10:16 am


-----------------------------------
Ok...

For this you'll need to look up on View.Update, and flicker reduction.  Conventiantly, there just happens to be a great tutorial on the very subject!  Amazing what you'll find in that section:

[url=http://www.compsci.ca/v2/viewtopic.php?t=193]No more screen flickers! by tony

The idea is that you'll consider the screen in two layers.  You have the background, and the foreground.  Each frame, you redraw the background, then you update the position of the objects (foreground) over the background.  Then you View.Update the whole screen - effectively producing a clean animation.
Enjoy.

-----------------------------------
dying to live
Fri Oct 29, 2004 7:19 am


-----------------------------------
yeah so that didnt help me at all... :(

-----------------------------------
gigaman
Fri Oct 29, 2004 7:51 am


-----------------------------------
Here is a bit of an update for flikering 

use the setscreen command setscreen("offscreenonly")
then after every time it draw the object use View.Update

-----------------------------------
AsianSensation
Fri Oct 29, 2004 8:10 pm


-----------------------------------
I think he wants people to make a background for him. I am assuming using drawline and drawoval and stuff like that.

If that's what you want, search for Pic~2~Code by Delta, it's quite useful.
