forums

TNT Basic Forums > Bugs!
Declaring sprites
< Last Thread     Next Thread >
Author
Thread        Post A Reply

07-12-2003 13:07

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Hi,
I found that if I called a sprite thus:

sprite 9,300.500,128
draw frame

The error (there is a stop instead of a comma)is not picked up on by TNT and the sprite does not appear. Could this have anything to do with the below problem?

set pen colour white
Text size 14
fade up
draw text 40,100,"Blah, blah..Click to continue" 'This appears OK
sprite 9,300,500,128 'This doesn't(?)
draw frame
wait mouse click
fade down

feedback appreciated,
Mark_667

07-12-2003 15:49

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

Well, 300.500 is like 300.5 or 300 1/2, isn't it? So it's not an error, but the sprite should be shown anyway?

07-13-2003 12:56

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Quote:
Well, 300.500 is like 300.5
End quote
Eh, how can you have half a pixel?

Quote:
or 300 1/2, isn't it?
End quote
No, to do that you would need to do something like:

int x=100
int y=100/2

sprite 9,x,y

And there's no point in doing that anyway when you could just put int y=50.

Quote
So (if) it's not an error, but the sprite should be shown anyway?
End quote
I agree, anyone else got anything they would like to say on this?

07-13-2003 21:16

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

The sprite command's syntax is:

sprite id, x, y, image

You code is

sprite 9, x, y

The Sprite command allows you to omit specifying parameters if you want them to keep the same value, so by omitting the image for the sprite, you're saying use the same image as last time, but you've not displayed the sprite yet, so it just sits at x,y waiting for you to set an image with something like

sprite 9, , , 2 ' nb omitting x and y means keep at same location

Hope this helps,

Mark

07-15-2003 13:18

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Hi,
found the answer by looking over the source for 'Bang On!', which has the code:

Set Image Bank 0,kPowerUpBank
Sprite 0,Mouse X,Mouse Y,0

I've been delcaring the last variable as 128 (the default image bank ID), which didn't work even when I called the set Image bank command, but when I tried the above code it worked fine, even thought there is no image bank ID 0(?) Oh, and missing out the x and y co-ords, in my case, does nothing as it is the first sprite to be called and so cannot be placed in the same place as the last.
Anyway, works now, thanks a lot!

07-21-2003 23:04

Posted by:
Mark Tully

Location:
TNT HQ, England

Click Here to Email Mark Tully   Find more posts by Mark Tully

Hi,

Set Image Bank 0,kPowerUpBank
Sprite 0,Mouse X,Mouse Y,0


set image bank : first param spriteid last param bank number
sprite command : last param image index into the sprites current bank

These commads therefore tell sprite 0 to use kPowerUpBank and then tell sprite 0 to display at the mouse location with image 0.

There's no reference to image bank 0 - or am I misunderstanding you?

Cheers,

Mark

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.