Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 animation + proc problem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
kyoshiro




PostPosted: Sun Jan 11, 2004 12:19 pm   Post subject: animation + proc problem

I've created an intro page for a program and it needs a bit of tweaking. One of the first problems is the buttonwait procedure. When i run my program it executes by calling specific procedures in order, however, the last procedure is called b4 the procedure b4 it was finished.

Quote:

% elevator intro page

setscreen ("graphics:640;480")
drawfill (1, 1, red, red)

%%%%%%%%%%%%%%%%%%%%%%%%
proc intro ()
var FontID, FontID2 : int
FontID := Font.New ("Arial:35:Italic,Bold,underline")
FontID2 := Font.New ("Arial:35:Italic,Bold,underline")

for decreasing x : 20 .. 15

Font.Draw ("The Elevator Program", 55 + x + 5, 340 + x + 5, FontID, x)
if x = 15 then
Font.Draw ("The Elevator Program", 55 + x + 5, 340 + x + 5, FontID2, white)
end if
delay (150)
end for

end intro
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc introfinal ()
var FontID, FontID2 : int
FontID := Font.New ("Arial:35:Italic,Bold,underline")
FontID2 := Font.New ("Arial:35:Italic,Bold,underline")

for decreasing x : 20 .. 15

Font.Draw ("The Elevator Program", 55 + x + 5, 340 + x + 5, FontID, x)
if x = 15 then
Font.Draw ("The Elevator Program", 55 + x + 5, 340 + x + 5, FontID2, white)
end if
end for
end introfinal
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
proc movingbox
setscreen ("offscreenonly")
View.Update

for y : 1 .. 100 by 10
introfinal ()
drawfill (1, 1, red, red)
% a counted loop that is stored in the variable y
drawfillbox (240, 160 - y, 400, 320 - y, blue)
drawline (400, 160 - y, 440, 200 - y, blue)
drawline (400, 320 - y, 440, 360 - y, blue)
drawline (440, 200 - y, 440, 360 - y, blue)
drawline (240, 320 - y, 280, 360 - y, blue)
drawfill (420, 200 - y, brightblue, blue)
drawline (280, 360 - y, 440, 360 - y, blue)
drawfill (300, 350 - y, brightcyan, blue)
View.Update
cls
drawfill (1, 1, red, red)
delay (300)
%draws a box that look 3d and has different shades of blue
end for
introfinal ()
drawfillbox (240, 60, 400, 220, blue)
drawline (400, 60, 440, 100, blue)
drawline (400, 220, 440, 260, blue)
drawline (440, 100, 440, 260, blue)
drawline (240, 220, 280, 260, blue)
drawfill (420, 100, brightblue, blue)
drawline (280, 260, 440, 260, blue)
drawfill (300, 250, brightcyan, blue)

end movingbox

proc button1 ()
var FontID : int
FontID := Font.New ("Arial:25:Italic,Bold")
drawbox (500, 50, 600, 100, black)

Font.Draw ("Start", 512, 65, FontID, black)


var x, y, bud, bnum, num1, num2 : int := 0

buttonwait ("up", x, y, bud, bnum)

if x >= 500 and x <= 600 and y >= 50 and y <= 100 then
cls
end if
end button1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%END OF PROCEDURES%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


%THE CALLING OF PROCS%%

intro ()
movingbox ()
button1 ()


For instance, when i call movingbox() it executes, the box is supposed to move down and draw a button. Then After that is done, it supposed to call button1(); however, b4 the moving box finishes and draws the button, the buttonwait is excuted. When i press outside the button (which isnt drawn yet) it then draws the button -.-;! plx help
Sponsor
Sponsor
Sponsor
sponsor
CITC




PostPosted: Sun Jan 11, 2004 7:29 pm   Post subject: (No subject)

whats your question?
kyoshiro




PostPosted: Mon Jan 12, 2004 10:06 pm   Post subject: (No subject)

why does buttonwait occur b4 the button is drawn.. my teacher and i cannot get it to work. could it be a problem in the compiles Turing 4.0.3
DanShadow




PostPosted: Tue Jan 13, 2004 8:57 am   Post subject: (No subject)

I dont see any buttonwait commands....maybe put it in bold?
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: