Computer Science Canada

Sprite Help

Author:  Anonymous [ Fri Aug 11, 2006 4:54 pm ]
Post subject:  Sprite Help

For some reason when I use this specific Gif image, when I move it from it's original position, it get's all distorted (regardless of background). But all other gifs I tried work fine. Is there a special way to fix this such as the Pic.Merge or some method? Here is this gif then my code:
Posted Image, might have been reduced in size. Click Image to view fullscreen.
code:

var numFrames : int := Pic.Frames ("%directory")
var pics : array 1 .. numFrames of int
var x, y := 50
var delayTime : int
var keys : array char of boolean

Pic.FileNewFrames ("%directory", pics, delayTime)

Draw.FillBox (0, 0, maxx, maxy, black)

var sprite : int
sprite := Sprite.New (pics (1))
Sprite.SetPosition (sprite, 0, 100, false)
Sprite.Show (sprite)

loop
    Input.KeyDown (keys)
    if keys (KEY_LEFT_ARROW) or keys ('a') then
        x -= 1
    elsif keys (KEY_RIGHT_ARROW) or keys ('d') then
        x += 1
    end if
    if keys (KEY_UP_ARROW) or keys ('w') then
        y += 1
    elsif keys (KEY_DOWN_ARROW) or keys ('s') then
        y -= 1
    end if
    Sprite.Animate (sprite, pics ((x div 8) mod numFrames + 1), x, y, false)
    delay (3)
end loop
Sprite.Free (sprite)

Author:  Anonymous [ Thu Aug 24, 2006 9:43 pm ]
Post subject: 

Any help?

Author:  [Gandalf] [ Fri Aug 25, 2006 3:27 am ]
Post subject: 

Be patient? Don't double post?

As far as I've seen, certain GIF images don't work well with Turing 4.1's GIF support. Feel free to experiment on your own, though, it might be interesting to find out what causes this.

Author:  Delos [ Fri Sep 01, 2006 3:01 pm ]
Post subject: 

If you're still working on this - perhaps try changing the BG colour (currently black). If you can still 'see-through' the GIF, then it's a transparency issue. Which means you should be using picCopy and not picMerge in drawing the pictures. Given that you're using Turing's Sprite.() module, you might have to do a bit of digging to figure out how to do this.


: