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

Username:   Password: 
 RegisterRegister   
 Play M8's Mini Golf
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
copthesaint




PostPosted: Sat Feb 28, 2009 10:27 am   Post subject: Play M8's Mini Golf

Now normally I would have trouble loading the vars from a text file but for some reason it isn't working.
The Golf ball position should be at 100, 100 but it always put 0,0... any help? I also used the find to see if I was setting The golf ball X somewhere else but I couldn't find it...



MiniGolf.zip
 Description:

Download
 Filename:  MiniGolf.zip
 Filesize:  34.41 KB
 Downloaded:  89 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
The_Bean




PostPosted: Sat Feb 28, 2009 3:07 pm   Post subject: Re: Play M8's Mini Golf

Your initializing the ball to 0 at the beginning of the program.
When you load from the file it doesn't actually change the value, and the loading looks a lot more complicate than it actually needs to be.
You should actually be using a 2D arrays to hold the map info.

My loading for this http://compsci.ca/v3/viewtopic.php?t=19194&highlight=putt+putt was:
Turing:

    open : fileNum, "maps/" + maps (strint (mapNum) + 2), get
    for decreasing y : 19 .. 0
        for x : 0 .. 19
            get : fileNum, map (x, y)
        end for
    end for
    get : fileNum, xBall, yBall
    get : fileNum, xHole, yHole
    close : fileNum
copthesaint




PostPosted: Sat Feb 28, 2009 6:43 pm   Post subject: Re: Play M8's Mini Golf

The_Bean wrote:

Your initializing the ball to 0 at the beginning of the program.
When you load from the file it doesn't actually change the value, and the loading looks a lot more complicate than it actually needs to be.

No it's being set...

Line : 56
code:
GolfballXSet := strreal (line)


line 310
code:
procedure GolfBallDraw
    GolfballXSet += GolfballXincr
    GolfballYSet += GolfballYincr
    GolfballX1 := GolfballXSet
    GolfballY1 := GolfballYSet
    Pic.Draw (GolfBall, round (GolfballX1), round (GolfballY1), picMerge)
    GolfballX2 := GolfballX1 + Pic.Width (GolfBall)
    GolfballY2 := GolfballY1 + Pic.Height (GolfBall)
end GolfBallDraw
The_Bean




PostPosted: Sun Mar 01, 2009 1:06 pm   Post subject: Re: Play M8's Mini Golf

Turing:

        elsif nextvar = 5 and skipvar = 0 and strintok (line) = true then
            put 'the x value is being set'
            delay (100000)
            GolfballXSet := strreal (line)
            skipvar := 1
            nextvar := 6

The program is never delayed because the delay is never run because theres something wrong with the way your loading, which means that the x value of the golf ball isn't being set.
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: