
-----------------------------------
Weapon X
Mon Apr 11, 2005 12:04 pm

program help plz
-----------------------------------
here is my code. i dont know whts wrong, can someone help plz? i know i have to put in a cls but i dont know where


import "DanSprite.tu"
setscreen ("graphics,nobuttonbar") 
setscreen ("offscreenonly") 
var x, y : int %var for the first sprite
var x2, y2 : int %var for the second sprite
var x3, y3 : int %var for the 1st ovals quadents 
var x4, y4 : int %var for the 2nd ovals quadents 
var nx3, ny3, nx4, ny4 : int := 1 %vars for the chage in qroadents 
var s : int := 10 %var for the size of the ovals 
var chars : array char of boolean 


x := 1
y := 1
x2 := 100
y2 := 100
var pic : int := DanSprite.newPic (x, y, "slime1.jpg") 
DanSprite.setMode(pic,DanSprite.MERGE) 
var pic2 : int := DanSprite.newPic (x2, y2, "slime2.jpg") 
DanSprite.setMode(pic2,DanSprite.MERGE) 
x3 := Rand.Int (1, 100) %set the x quadent for the 1st oval 
y3 := Rand.Int (1, 100) %set the y quadent for the 1st oval 
x4 := Rand.Int (1, 100) %set the x quadent for the 2nd oval 
y4 := Rand.Int (1, 100) %set the y quadent for the 2nd oval 

%main loop 
loop 
    if Input.hasch then 
        Input.KeyDown (chars) 
        if chars (KEY_UP_ARROW) then 
            y += 10
            DanSprite.movePic (x, y, pic)  
            end if 
        if chars (KEY_RIGHT_ARROW) then 
            x += 10 
            DanSprite.movePic (x, y, pic) 
            end if 
        if chars (KEY_LEFT_ARROW) then 
            x -= 10
            DanSprite.movePic (x, y, pic)  
        end if 
        if chars (KEY_DOWN_ARROW) then 
            y -= 10 
            DanSprite.movePic (x, y, pic) 
        end if 
        
        if chars ('w') then 
            y2 += 10 
            DanSprite.movePic (x2, y2, pic2) 
        end if 
        if chars ('d') then 
            x2 += 10 
            DanSprite.movePic (x2, y2, pic2) 
        end if 
        if chars ('a') then 
            x2 -= 10 
            DanSprite.movePic (x2, y2, pic2) 
        end if 
        if chars ('s') then 
            y2 -= 10 
            DanSprite.movePic (x2, y2, pic2) 
        end if 

 end if 
    
    drawfilloval (x3, y3, s, s, red) %draws the 1st oval 
    drawfilloval (x4, y4, s, s, green) %draws the 2nd one   
    
     View.Update     


    
    %check to see if oval gose off the screen 
    %for oval 1 
    
    if x3 = maxy then %check to see if it gose off to the right 
        ny3 := - 1 %chages the direction 
    end if 

 
    %check to see if oval gose off the screen 
    %for oval 2 
    
    if x4 = maxy then %check to see if it gose off to the right 
        ny4 := - 1 %chages the direction 
    end if 



    %this if checks to see if the ovals have hit each other 
    if x3 + s > x2 - s and x2 - s < x2 + s and y2 + s > y2 - s and y2 - s < y2 + 
            s then 
        



        %chages the direction of all the ovals 
        nx3 := nx3 * - 1 
        ny3 := ny3 * - 1 
        nx4 := nx4 * - 1 
        ny4 := ny4 * - 1 
    end if 

    %this part adds the chage in qroadents to the 
    %quradents and makes the ovals move 
    x3 += nx3 
    y3 += ny3 
    x4 += nx4 
    y4 += ny4 

    delay (0) 
     
end loop 

-----------------------------------
Tony
Mon Apr 11, 2005 1:21 pm


-----------------------------------
just after the View.Update is where cls usually goes

-----------------------------------
jamonathin
Mon Apr 11, 2005 1:34 pm


-----------------------------------
Next time just put everything into one zip file (or rar).  No one's going to want to download each, then save all of them individually.
