Computer Science Canada

Having trouble with arrays and images

Author:  Rocket [ Thu May 18, 2006 5:31 pm ]
Post subject:  Having trouble with arrays and images

Basic story here, school project, im making a casino program, i'm currently working on the blackjack and poker parts of it. I created an array for the pictures of each card to be stored in. however when i run it telles me compile time expression expected.

any help is great, thanks

code:

var BJCardPicture : array 1 .. 52 of int := init (Pic.FileNew ("aceheart.jpg"),
    Pic.FileNew ("2heart.jpg"), Pic.FileNew ("3heart.jpg"),
    Pic.FileNew ("4heart.jpg"), Pic.FileNew ("5heart.jpg"),
    Pic.FileNew ("6heart.jpg"), Pic.FileNew ("7heart.jpg"),
    Pic.FileNew ("8heart.jpg"), Pic.FileNew ("9heart.jpg"),
    Pic.FileNew ("10heart.jpg"), Pic.FileNew ("jackheart.jpg"),
    Pic.FileNew ("queenheart.jpg"), Pic.FileNew ("kingheart.jpg"),
    Pic.FileNew ("acediamond.jpg"), Pic.FileNew ("2diamond.jpg"),
    Pic.FileNew ("3diamond.jpg"), Pic.FileNew ("4diamond.jpg"),
    Pic.FileNew ("5diamond.jpg"), Pic.FileNew ("6diamond.jpg"),
    Pic.FileNew ("7diamond.jpg"), Pic.FileNew ("8diamond.jpg"),
    Pic.FileNew ("9diamond.jpg"), Pic.FileNew ("10diamond.jpg"),
    Pic.FileNew ("jackdiamond.jpg"), Pic.FileNew ("queendiamond.jpg"),
    Pic.FileNew ("kingdiamond.jpg"), Pic.FileNew ("acespade.jpg"),
    Pic.FileNew ("2spade.jpg"), Pic.FileNew ("3spade.jpg"),
    Pic.FileNew ("4spade.jpg"), Pic.FileNew ("5spade.jpg"),
    Pic.FileNew ("6spade.jpg"), Pic.FileNew ("7spade.jpg"),
    Pic.FileNew ("8spade.jpg"), Pic.FileNew ("9spade.jpg"),
    Pic.FileNew ("10spade.jpg"), Pic.FileNew ("jackspade.jpg"),
    Pic.FileNew ("queenspade.jpg"), Pic.FileNew ("kingspade.jpg"),
    Pic.FileNew ("aceclub.jpg"), Pic.FileNew ("2club.jpg"),
    Pic.FileNew ("3club.jpg"), Pic.FileNew ("4club.jpg"),
    Pic.FileNew ("5club.jpg"), Pic.FileNew ("6club.jpg"),
    Pic.FileNew ("7club.jpg"), Pic.FileNew ("8club.jpg"),
    Pic.FileNew ("9club.jpg"), Pic.FileNew ("10club.jpg"),
    Pic.FileNew ("jackclub.jpg"), Pic.FileNew ("queenclub.jpg"),
    Pic.FileNew ("kingclub.jpg"))

Author:  TheOneTrueGod [ Thu May 18, 2006 5:40 pm ]
Post subject: 

Ew, thats a mouthful of code right there. Allright, first of all, it would be much prettier, as well as more efficient for you, if you loaded a character map, then used some math to load the pictures from the screen. I wrote a tutorial on using character maps in the Turing Walkthrough.

As for your problem, i'm not sure why it does that. My best guess would be that you have to set them separately from the Init statement.


: