Computer Science Canada

cls help

Author:  YasserSalama [ Mon May 26, 2008 12:35 pm ]
Post subject:  cls help

can you tell us what the problem is when we try to have our characters (bob and john) come up on the screen and the kapow come up also, then have them dissappear and only john and bob will come up after the cls

code:

View.Set ("offscreenonly")
View.Update
setscreen ("graphics:1024;768")
var font : int := Font.New ("chinaone:40:bold")
var change, j, l: int
change := 1
j := 1
l := 600
procedure bob
drawfilloval (l, 300, 20, 20, green)
drawline (l, 300, l, 200, green)
drawline (l, 200, l + 25, 150, green)
drawline (l, 200, l - 25, 150, green)
drawline (l, 250, l + 40, 275, green)
drawline (l, 250, l - 40, 275, green)
drawfilloval (l + 40, 275, 8, 8, green)
drawfilloval (l - 40, 275, 8, 8, green)
drawline (l - 25, 250, l + 25 ,225, green)
drawline (l - 5, 250, l - 10, 225, green)
end bob
procedure john
drawfilloval (j, 300, 20, 20, black)
drawline (j, 300, j, 200, black)
drawline (j, 200, j + 25, 150, black)
drawline (j, 200, j - 25, 150, black)
drawline (j, 250, j + 40, 275, black)
drawline (j, 250, j - 40, 275, black)
drawfilloval (j + 40, 275, 8, 8, black)
drawfilloval (j - 40, 275, 8, 8, black)
drawline (j - 25, 250, j + 25 ,225, black)
drawline (j - 5, 250, j - 10, 225, black)
l := l - 1
end john
loop
bob
john
if change = 1 then
j := j + 1
elsif change = -1 then
View.Update
end if
delay (1)
cls                                                             
change := -change
exit when l = j + 95
bob
john
delay (10)
end loop
drawfillstar (100, 250, 500, 600, red)
Font.Draw ("KAPOW!!", 200, 400, font, black)
cls
bob
john

Author:  Sean [ Mon May 26, 2008 2:21 pm ]
Post subject:  Re: cls help

Well, it seems that you are cls'ing at the end of the program and calling back those to procedures. Since the Kapow is outside of a procedure and the loop, it will only call it once, and will not be available to use again.


: