forums

TNT Basic Forums > Bugs!
Sprite won't draw with buttons
< Last Thread     Next Thread >
Author
Thread        Post A Reply

02-18-2004 12:32

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Hi,
this may just be my bad programming, but when I try to put the logo as a sprite it does not draw onscreen, but everything else does. It uses the same image bank as the button images and when I put it as a button it draws normally. Why is this and is it a bug? The code is included below.

Procedure Menu()
load images 131 'Buttons image bank
set image bank 0,131

set pen colour black
paint canvas

new button 0,10,30,3,3,3,131
new button 1,400,50,2,2,2,131
new button 2,20,250,1,1,1,131
new button 3,400,350,0,0,0,131
new button 4,200,420,4,4,4,131
new button 5,340,200,5,5,5,131

'sprite 5,340,200,131 'Logo
draw frame
wait button click

if button click = 0
unload images 131
Part1()
else if button click = 1
unload images 131
Part2()
else if button click = 2
unload images 131
Part3()
else if button click = 3
unload images 131
Part4()
else if button click = 4
End
end if

clear buttons
end proc

02-18-2004 18:46

Posted by:
-wyvern

Location:
Bedroom

Find more posts by -wyvern

If you want to specifically set an image bank, you must do so after you have declared the sprite. Further, the number at the end of the sprite command should be the image you want to use, not the bank id. Example:

What you were doing...

load images 131
set image bank 0,131

...

sprite 5,x,y,131

...And you should have either done this...

load images 131
set default image bank 131

...

sprite 5,x,y,0

NOTE: the zero at the end is image zero in your bank - ie the first one you see in the panel in the graphics editor. I am assuming that you do not have a bank that shares over 131 images for the title screen alone.

...But you could also do this...

load images 131

...

sprite 5,x,y,0
set image bank 5,131

...The former version might interfere with other sprites, but the latter is slower if you are repeating the section over and over and over since you are parsing an instruction that does not need to be there, although in a static menu like yours this does not apply. Tell me if it works, it's just off the top of my head.

02-19-2004 19:04

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

That fixed it, I must have misunderstood the syntax, thanks Wyvern.

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.