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

Username:   Password: 
 RegisterRegister   
 Error, cant seem to know whats happening.
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
ZeroPaladn




PostPosted: Wed Oct 12, 2005 1:17 pm   Post subject: Error, cant seem to know whats happening.

this is a project for class (i will admit it, unlike some people) and ive got an error that stumps me.
code:
/*
 Fish Jumping
 Dylan Kuehl
 jumpingfish.t
 This program will draw a jumping fish.
 */

setscreen ("graphics:600;400,offscreenonly")

var fish : int := Pic.FileNew ("fishy.bmp") %level fish
var upfish : array 0..45 of int
var downfish : array 0..45 of int
var water : int := Pic.FileNew ("water.bmp") %water
var fishx, fishy : int := 0%location coordinates
var x : int := 0

colorback (43)
cls

procedure bgdraw %begins background procedure
for i : 0..400 by 200
Pic.Draw (water, i, 0, picMerge) %draws water bg onto screen
end for
Draw.FillOval (50, 350, 50, 50, brightred) %draws sun
end bgdraw

procedure rotateup
x := 0
for decreasing o : -1..-45
cls
bgdraw
x := x + 1
upfish (x) := Pic.Rotate (fish, o, 100, 100)
Pic.Draw (upfish (x), fishx, fishy, picMerge)
View.Update
end for
end rotateup

procedure rotatedown
x := 0
for p : 1..45
x := x + 1
downfish (x) := Pic.Rotate (fish, p, 100, 100)
end for
end rotatedown

bgdraw

fishx := 425
fishy := 25

Pic.Draw (fish, fishx, fishy, picMerge)
View.Update

rotateup

loop
cls
bgdraw
Pic.Draw (upfish (45), fishx, fishy, picMerge)
fishx := fishx - 1
fishy := fishy + 2
View.Update
exit when fishx = 325 and fishy = 225
end loop

for decreasing y : 45 .. 1
cls
bgdraw
Pic.Draw (upfish (y), fishx, fishy, picMerge)
fishx := fishx - 1
View.Update
end for

for t : 1..44
cls
bgdraw
[color=orange]Pic.Draw (downfish (t), fishx, fishy, picMerge)[/color]
fishx := fishx - 1
View.Update
end for


the orange line is where the error occurs.
Variable has no value.

If you want me to upload all the pics and the .t file, ill be glad to.

thanks in advance
Sponsor
Sponsor
Sponsor
sponsor
beard0




PostPosted: Wed Oct 12, 2005 1:25 pm   Post subject: (No subject)

You define the procedure rotatedown, which is where you assign values to your downfish array, yet you never call it; thus downfish "has no value" as Turing correctly tells you.
ZeroPaladn




PostPosted: Thu Oct 13, 2005 8:39 am   Post subject: (No subject)

lots o' thanks to you beardo, you saved it.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: