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

Username:   Password: 
 RegisterRegister   
 Card game shapes!!! moving procedures!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
xHoly-Divinity




PostPosted: Thu Dec 02, 2004 10:41 am   Post subject: Card game shapes!!! moving procedures!!!

code:


proc club (var xx, yy : int)
    drawfilloval (400 + xx, 100 + yy, 7, 7, black)
    drawfilloval (392 + xx, 90 + yy, 7, 7, black)
    drawfilloval (408 + xx, 90 + yy, 7, 7, black)
    Draw.ThickLine (400 + xx, 90 + yy, 400 + xx, 75 + yy, 5, black)
    Draw.ThickLine (396 + xx, 74 + yy, 404 + xx, 74 + yy, 3, black)
end club

club (50, 50)



I do not know what is wrong with the code. It doesn't move the procedure. I get an error stating 'non variable passed to variable format'
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Thu Dec 02, 2004 10:45 am   Post subject: (No subject)

Your paramters for your proc have been declared in variable format. Instead, declare your procedure as:

code:

proc club (xx, yy : int)
%...


This way the paramters may be hardcoded ints or variables, but may not be editted at anypoint during the proc.
xHoly-Divinity




PostPosted: Thu Dec 02, 2004 11:17 am   Post subject: (No subject)

Ahhh ic ic. Thank you. But now I am having another problem. I am using the drawfillpolygon command and I end up getting an error.

code:

procedure spade (xx, yy : int)
    drawfilloval (113 + xx, 98 + yy, 12, 10, black)
    Draw.ThickLine (113 + xx, 98 + yy, 113 + xx, 80 + yy, 7, black)
    Draw.ThickLine (105 + xx, 79 + yy, 120 + xx, 79 + yy, 3, black)
    var x : array 1 .. 3 of int := init (100 + xx, 126 + xx, 113 + xx)
    var y : array 1 .. 3 of int := init (100 + yy, 100 + yy, 119 + yy)
    Draw.FillPolygon (x, y, 3, black)
end spade

spade (50, 50)




I have tried doing it that way and

code:


procedure spade (xx, yy : int)
    drawfilloval (113 + xx, 98 + yy, 12, 10, black)
    Draw.ThickLine (113 + xx, 98 + yy, 113 + xx, 80 + yy, 7, black)
    Draw.ThickLine (105 + xx, 79 + yy, 120 + xx, 79 + yy, 3, black)
    var x : array 1 .. 3 of int := init (100, 126, 113)
    var y : array 1 .. 3 of int := init (100, 100, 119)
    Draw.FillPolygon (x+xx, y+yy, 3, black)
end spade


that way. But for both I get an error. I really need help with this if there is a way to fix it!!!!!!
Viper




PostPosted: Thu Dec 02, 2004 2:09 pm   Post subject: (No subject)

try putting the polygon somewhere else bc i think the problem is with the x+xx and y+yy since xx and yy havent been previously declared it has nothing 2 add 2 x and y im not totaly sure though
Delos




PostPosted: Thu Dec 02, 2004 3:25 pm   Post subject: (No subject)

I couldn't tell you why, but replace the init clause with direct initializations, and it will work.

Perhaps someone who could translate "compile time expression"...I used to know what that meant...something about certain things that must be computable before compilation...[sigh]
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  [ 5 Posts ]
Jump to:   


Style:  
Search: