
-----------------------------------
neufelni
Wed Jun 08, 2005 11:06 am

Help with View.Update
-----------------------------------
How can you use View.Update so that it does not slow everything down? I am making a game and need to use View.Update but it is slowing everything down.

-----------------------------------
jamonathin
Wed Jun 08, 2005 11:26 am


-----------------------------------
Send your code over, because you only need View.Update one (most of the time), and you could possibly have something else slowing it down.  So, send ur code over, and if ur gonan send pics too, zip it or rar it, please and thank you.

-----------------------------------
neufelni
Wed Jun 08, 2005 1:09 pm


-----------------------------------
Send your code over, because you only need View.Update one (most of the time), and you could possibly have something else slowing it down.  So, send ur code over, and if ur gonan send pics too, zip it or rar it, please and thank you.

Here is my code, with View.Update in it. The ball and the paddle moved much faster when I did not have it in there, but I need it to get the paddle to stop flickering as much. Please help.

[code]
View.Set ("graphics: max; max, nocursor, nobuttonbar, offscreenonly")
colourback (black)
cls

var x : int := 250
var x2 : int := 300
var y : int := 100
var speed : int := 5
var x3, y3 : int := 1
var paddleinput : array char of boolean

Draw.FillBox (0, 0, 40, maxy, 46)
    Draw.FillBox (0, maxy, maxx - 400, maxy - 40, 46)
    Draw.FillBox (maxx - 400, maxy, maxx - 440, 0, 46) 
    Draw.FillBox (75, maxy - 200, 200, maxy - 220, 100)
    Draw.FillBox (125, maxy - 160, 145, maxy - 260, 100) 
        
    loop
        Draw.FillOval (x2, y, 10, 10, 7)
            x2 += x3  
        y += y3
        Draw.FillOval (x2, y, 10, 10, Rand.Int (1, 93)) 
        delay (speed)                                    
        if x2 + 11 = maxx - 440 or x2 - 11 = 40 then
            x3 := x3 * -1
        elsif y + 11 = maxy - 40 then
            y3 := y3 * -1            
        elsif y - 11 = 65 and x2 > x and x2 < x + 100 then
            y3 := y3 * -1
        elsif x2 - 11 = 200 or x2 + 11 = 75 and y > maxy - 260 and y < maxy - 160 then
             
        end if 
      
        Draw.FillBox (x, 50, x + 100, 65, 14)           
        Input.KeyDown (paddleinput)   
        if paddleinput (KEY_RIGHT_ARROW) and x + 101 < maxx - 440 then  
            Draw.FillBox (x, 50, x + 100, 65, 7)
            x := x + 1
            delay (1)
        elsif paddleinput (KEY_LEFT_ARROW) and x - 1 > 40 then  
            Draw.FillBox (x, 50, x + 100, 65, 7)
            x := x - 1
            delay (1)
        end if
        exit when y = 0
        View.Update
    end loop  
    [\code]

-----------------------------------
jamonathin
Wed Jun 08, 2005 1:10 pm


-----------------------------------
Well, you weren't using View.Update properly, but thats not why it was slowing down.  View.Update slows anything down, face it.  So we work on everything else. You're moving everything by 1 pixel at a time, change it!  use 2,3 or 7 pixels at a time. 
 Also, dont draw black overtop of what you're drawing, just redraw everything.

Don't use x = 100 or anything thing like that, use x >=100 or x 