Computer Science Canada

cant make a sprite move

Author:  Weapon X [ Sat Feb 26, 2005 1:12 pm ]
Post subject:  cant make a sprite move

i m making a game for a project at school and i cant get the sprites to move. here is wht i my code for the sprite is:
var x, y : int := 0
var pic1 : int := Pic.FileNew ("slime1.jpg")
var sprite : int := Sprite.New (pic1)
var centered : boolean := false
var chars : array char of boolean

Sprite.Show (sprite)

Sprite.SetHeight (sprite, 1)

loop
Input.KeyDown (chars)
if chars (KEY_UP_ARROW) then
y += 100
end if
if chars (KEY_DOWN_ARROW) then
y -= 100
end if
if chars (KEY_LEFT_ARROW) then
x -= 100
end if
if chars (KEY_RIGHT_ARROW) then
x += 100
end if
Sprite.SetPosition (sprite, 100, 100, centered)


end loop
. the program runs but i cant c the pic. somebody plz help. thanx
code:

Author:  Tony [ Sun Feb 27, 2005 12:22 am ]
Post subject: 

Sprites have stoped working in v4.x, although Dan has a solution.

Author:  Flikerator [ Sun Feb 27, 2005 11:31 am ]
Post subject: 

How is a sprite different from a just a picture?

Author:  cycro1234 [ Sun Feb 27, 2005 12:21 pm ]
Post subject: 

With sprites, animation is easier. They don't erase the background when they move. You can also set a depth to them, so they can be part of the background or actual moving figures.

Author:  Flikerator [ Sun Feb 27, 2005 12:32 pm ]
Post subject: 

cycro1234 wrote:
With sprites, animation is easier. They don't erase the background when they move. You can also set a depth to them, so they can be part of the background or actual moving figures.


Alrite thanks, mabey I shall attempt them Razz

Author:  Bacchus [ Sun Feb 27, 2005 1:02 pm ]
Post subject: 

yes but as Tony said, they got rid of sprites in the newer versions of Turing. there is a substitue though... DanSprite (Tony posted a link above) there are a few other files as well, but DanSprite is to be used with offscreenonly while osme other are not. However, DanSprite does have a few bugs (as i found out when i tried to use it). I was pretty sure that he was to busy to update it more so i decided to make my own, and when i finish most of the little details i will be submitting it into the tutorials section with a description on how to use. hmm.. which reminds me maybe i should do more Shocked


: