Computer Science Canada

Need Help Attaching Pictures and animating them

Author:  cool1143 [ Sat Dec 05, 2009 4:00 pm ]
Post subject:  Need Help Attaching Pictures and animating them

What is it you are trying to achieve?
DDR (dance dance revolution game), need to have an arrow move upwards


What is the problem you are having?
Have no idea how to make a picture of an arrow move upwards, i already can make an turing drawn arrow move upwards, but not an actual picture

Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)

Turing:


var x1, x2, x3 : int  %values for x co-ordinates
var y1, y2, y3 : int  %values for y co-ordinates

%declares all the co-ordinates so it is easier to modify

x1 := 100
x2 := 125
x3 := 125
y1 := 100
y2 := 115
y3 := 85

for i : 1..400
drawline (x1,y1, x2, y2, brightblue) % draws triangle
drawline (x2,y2, x3, y3, brightblue)
drawline (x1,y1, x3, y3, brightblue)
delay (3)
drawline (x1,y1, x2, y2, white) % erases triangle
drawline (x2,y2, x3, y3, white)
drawline (x1,y1, x3, y3, white)
y1 += 1
y2 += 1
y3 += 1
end for



Please specify what version of Turing you are using
Turing 4.1.1

Author:  Tony [ Sat Dec 05, 2009 4:15 pm ]
Post subject:  Re: Need Help Attaching Pictures and animating them

cool1143 @ Sat Dec 05, 2009 4:00 pm wrote:
i already can make an turing drawn arrow move upwards, but not an actual picture

They work the same way. You can apply the same technique to move where the image files are drawn just the same.

Author:  cool1143 [ Sat Dec 05, 2009 5:00 pm ]
Post subject:  Re: Need Help Attaching Pictures and animating them

what i mean is that how do you replace the turing drawn triangle with the picture attached...

Author:  TheGuardian001 [ Sat Dec 05, 2009 5:05 pm ]
Post subject:  Re: Need Help Attaching Pictures and animating them

Use Pic.FileNew to load the image, and Pic.Draw to display it where you want.

Author:  cool1143 [ Sat Dec 05, 2009 5:14 pm ]
Post subject:  Re: Need Help Attaching Pictures and animating them

ok... but what if the directory changes, because ill have to drop off the file later to another computer

Author:  Superskull85 [ Sat Dec 05, 2009 5:32 pm ]
Post subject:  Re: Need Help Attaching Pictures and animating them

Use a relative path as opposed to an absolute path. For example, <b>Pic.FileNew ("MyPicture.bmp")</b> as opposed to <b>Pic.FileNew (C:/MyPicture.bmp").</b>

Relative paths will add the current directory to the beginning of the path you specified. So if you have a picture called "MyPicture.bmp", and your program exists in the directory "C:/My Programs/Animation/" the overall path will become "C:/My Programs/Animation/MyPicture.bmp". Similarly if you copy your projects folder into a directory called "D:/Drop Off/" than the full path would become "D:/Drop Off/Animation/MyPicture.bmp".

Author:  cool1143 [ Sat Dec 05, 2009 6:03 pm ]
Post subject:  Re: Need Help Attaching Pictures and animating them

um... ok, i did the relative directory, but it saids illegal pic ID

Turing:

var ddrArrow : int
var x1, y1 : int := 100

ddrArrow := Pic.FileNew ("GIF:ddrarrow")
for i : 0 .. maxy
    Pic.Draw (ddrArrow, x1, y1, picUnderMerge)
    delay (10)
    y1 := y1 + 10
end for
Pic.Free (ddrArrow)


anything wrong??? and the pic is in the same directory with the same name : ddrarrow.gif

Author:  Superskull85 [ Sat Dec 05, 2009 6:33 pm ]
Post subject:  RE:Need Help Attaching Pictures and animating them

I like to simply use:

Turing:
ddrArrow := Pic.FileNew ("ddrarrow.gif")

Instead of the alternate way of passing an image. Also depending on your version of Turing GIF images may not be supported (even though the documentation implies that they are).

Author:  cool1143 [ Sat Dec 05, 2009 6:35 pm ]
Post subject:  Re: Need Help Attaching Pictures and animating them

i did both, and they still do not work

my version is 4.1.1

Author:  B-Man 31 [ Sat Dec 05, 2009 10:25 pm ]
Post subject:  RE:Need Help Attaching Pictures and animating them

have you tried loading it if it is in a .jpg or .bmp?

try to do that, if you open it up in paint, just save as a .jpg or .bmp and then try it. see if you still get that problem.

Author:  TheGuardian001 [ Sun Dec 06, 2009 1:22 am ]
Post subject:  Re: Need Help Attaching Pictures and animating them

It appears to actually be a problem with the image. opening it in an editor and resaving fixed the problem, downloading as a different format didn't.

Author:  cool1143 [ Sun Dec 06, 2009 2:03 pm ]
Post subject:  Re: Need Help Attaching Pictures and animating them

PROBLEM RESOLVED!!!! the original picture was corrupted... thank you all for helping me! My and my project partner hopefully would have a finished and working DDR game by the end of this week (i hope...)

Author:  cool1143 [ Tue Dec 08, 2009 1:41 pm ]
Post subject:  Re: Need Help Attaching Pictures and animating them

um... bump, delete topic, question answered? (how do you delete your topic)

Author:  Insectoid [ Tue Dec 08, 2009 1:42 pm ]
Post subject:  RE:Need Help Attaching Pictures and animating them

You don't. You leave it here so other people with the same problem might find it and fix it.

Author:  B-Man 31 [ Wed Dec 09, 2009 9:05 am ]
Post subject:  RE:Need Help Attaching Pictures and animating them

there is a question answered button in the little tool bar at the top right of your first post.


: