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

Username:   Password: 
 RegisterRegister   
 ERRRGGGG!!!!!!!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Uber Tankz




PostPosted: Thu Jun 08, 2006 8:51 pm   Post subject: ERRRGGGG!!!!!!!

umm can someone tell me why this dosent work?
code:
proc arrowleft
    var arrow : int
    arrow := Pic.FileNew ("ArrowLeft.jpg")
    Pic.SetTransparentColor (arrow, white)
    var arsprite : int := Sprite.New (arrow)
    Sprite.Show (arsprite)
end arrowleft

proc arrowright
    var arrow : int
    arrow := Pic.FileNew ("ArrowLeft.jpg")
    arrow := Pic.Rotate (arrow, 270, -1, -1)
    Pic.SetTransparentColor (arrow, white)
    var arsprite : int := Sprite.New (arrow)
    Sprite.Show (arsprite)
end arrowright

proc arrowup
    var arrow : int
    arrow := Pic.FileNew ("ArrowLeft.jpg")
    arrow := Pic.Rotate (arrow, 180, -1, -1)
    Pic.SetTransparentColor (arrow, white)
    var arsprite : int := Sprite.New (arrow)
    Sprite.Show (arsprite)
end arrowup

proc arrowdown
    var arrow : int
    arrow := Pic.FileNew ("ArrowLeft.jpg")
    arrow := Pic.Rotate (arrow, 90, -1, -1)
    Pic.SetTransparentColor (arrow, white)
    var arsprite : int := Sprite.New (arrow)
    Sprite.Show (arsprite)
end arrowdown

var arrowdir : array 2 .. 5 of procedure

arrowdir (2) := arrowleft
arrowdir (3) := arrowright
arrowdir (4) := arrowup
arrowdir (5) := arrowdown
loop
    arrowdir (Rand.Int (2, 5))
end loop
Sponsor
Sponsor
Sponsor
sponsor
TheOneTrueGod




PostPosted: Thu Jun 08, 2006 9:05 pm   Post subject: (No subject)

code:

var arrowdir : array 2 .. 5 of procedure


should be

code:

var arrowdir : array 2 .. 5 of procedure p


Though really, this isn't a good situation to be using multiple procedures... Just use one procedure, and parameters, as was stated in previous posts...
Uber Tankz




PostPosted: Thu Jun 08, 2006 9:11 pm   Post subject: i know

i know, right now im just makin it work im a make it efficient later. and whats with the p? why is it there? what does it do?
Uber Tankz




PostPosted: Thu Jun 08, 2006 9:13 pm   Post subject: uh oh

um, when i put the p ther it says it cant get the predef from the predef list. can that be fixed
Delos




PostPosted: Thu Jun 08, 2006 9:14 pm   Post subject: (No subject)

'p' is an identifier - a name. The term 'procedure' can not exist without an identifier (i.e., it cannot be anonymous). As for making it more efficient later - I'm afraid this isn't a case of efficiency as it is a case of sufficiency. And for those thinking along the lines of the evils of permature optimization - I'm quite certain that this doesn't even fall into that realm of thought!
In brevity: go with TOTG's suggestion and create a single procedure with parameters.
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: