Computer Science Canada


Author:  STE/-\LTH [ Fri Nov 22, 2002 3:11 pm ]
Post subject:  Sprites???


How on earth do you use sprites??!!!
when i try and use a command like Sprite.New, an error appears saying
"'New' is not in the export list of 'Sprite'"
What is this supposed to mean??? Evil or Very Mad
plz help Crying or Very sad

Author:  Dan [ Fri Nov 22, 2002 6:40 pm ]
Post subject:  hummm

this sownds like a bug in turing 3.1.1, you may whont to try resatring turing and trying to run the progame. also if you post the code of your progame it whode help.

Author:  STE/-\LTH [ Fri Nov 22, 2002 6:58 pm ]
Post subject: 

Confused But I have Turing 4.0.2 or sumthing! Confused

Author:  STE/-\LTH [ Fri Nov 22, 2002 6:59 pm ]
Post subject: 

OH yeah, its version 4.0.4a

Author:  STE/-\LTH [ Fri Nov 22, 2002 7:04 pm ]
Post subject: 

aiight then, this is an example i downloaded in my attempts to find out how to use sprites... among many others, all with the same problem

var facepic : int % This is the actuall picture (bmp)
facepic := Pic.FileNew ("face.bmp") % Turing loads the bmp here
var facesprite : int % This is the actuall sprite
facesprite := Sprite.New (facepic) % Turing takes the bmp and makes it a Sprite

Sprite.SetPosition (facesprite,maxx div 2, maxy div 2, true)
% What this means is we are setting the position of the facesprite in the middle of the screen and having the position
% centered around maxx div 2 maxy div 2. If we were to set it to false it would draw the sprite at the center of the
% screen instead of centering the picture.

Sprite.SetHeight (facesprite,1)
% This is telling turing to put the sprite 1 above the back ground. So we can still draw things on the background right now
% 0 means it will be the back ground
for i : 1..100
        delay (100)
        Sprite.SetPosition (facesprite,i,i,true)
        % Sprite.SetPosition (sprite id, x, y, center)
        % This will move our sprite 100 pixels up and to the right
end for

Sprite.Show (facesprite)

lol, i hope i did this right

Author:  Tony [ Fri Nov 22, 2002 8:45 pm ]
Post subject: 

ya... turing has a reputation of being messed up in many ways, sprites being one of them.

so if you're having trouble, there's an alternative of using Pic.Draw with PicMerge or PicUnderMerge modes.


if you put PicMerge for the mode of Pic.Draw, it will display the picture with a transparent background.

Author:  STE/-\LTH [ Fri Nov 22, 2002 9:32 pm ]
Post subject: 

So ive been fiddling around with the pic stuff, waht do piMerge and picUnderMerge do?
Im guseeing that one declares them like this
var player  := Pic.FileNew ("tiles/player.bmp")
Pic.SetTransparentColour (player , black)

you draw them using teh Pic.Draw (x,y,player, picMerge/UnderMerge),
as you explained, but i dont understand how these things work fully.

Author:  Tony [ Sat Nov 23, 2002 2:08 am ]
Post subject: 

The idea of sprites is to have an image with transparent background, so that you can have iregular shaped objects on screen... such as game character for example.

In most normal programming language, you can just load .gif image, but since haltsoft is too damn cheap to buy a licence for using gifs, you can't do that Evil or Very Mad

now you still can draw your game character using Pic.Draw with PicMerge mode. You use it the same way you use PicCopy.

To animate, you edit postion of images in your "render scene" part of code.

Also, white's the color for transparent background... If you happen to have some white that you want to keep, redraw the picture, editing those areas to 2nd closest color on 256 color scale.

Author:  JayLo [ Wed Dec 04, 2002 12:32 am ]
Post subject: 

could you post an example for newbs like me??

Author:  Tony [ Wed Dec 04, 2002 12:40 am ]
Post subject: 

sure, what kind of examples do you want?