
-----------------------------------
Uber Tankz
Thu Jun 08, 2006 8:51 pm

ERRRGGGG!!!!!!!
-----------------------------------
umm can someone tell me why this dosent work?
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


-----------------------------------
TheOneTrueGod
Thu Jun 08, 2006 9:05 pm


-----------------------------------

var arrowdir : array 2 .. 5 of procedure


should be


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
Thu Jun 08, 2006 9:11 pm

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
Thu Jun 08, 2006 9:13 pm

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
Thu Jun 08, 2006 9:14 pm


-----------------------------------
'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.
