forums

TNT Basic Forums > Programming Q&A
bounce
< Last Thread     Next Thread >
Author
Thread        Post A Reply

01-06-2004 00:15

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

i'm using tnt basic to prototype a little game and i'm having trouble with sprites. here's an example of the kind of problem i'm having.

graphics mode 800, 600
hide mouse
load images 128
int ballx = 1
int bally = 1
float dx = 10
float dy = 1
while not pressed(12)
if ballx >= 800
dx = dx * -1
dx = dx * 1.01
beep
else if ballx <= 0
dx = dx * -1
dx = dx * 1.01
beep
end if

if bally >= 600
dy = dy * -1
dy = dy * 1.01
beep
else if bally <= 0
dy = dy * -1
dy = dy * 1.01
beep
end if
ballx = ballx + dx
bally = bally + dy
sprite 0, ballx, bally, 128 '<----------
draw frame
wend

i see nothing but i can hear the system beep when the ball hits the wall. what's the deal?

01-06-2004 04:55

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

quote:
sprite 0, ballx, bally, 128 '<----------

The last number should be the image number, not the number of the bank. I doubt that you have an image 128 in your image bank, so you probably just need to change it to 0, or whatever image you have, and it should work.

01-07-2004 18:18

Posted by:
puffin

Click Here to Email puffin   Find more posts by puffin

thanks. what a silly mistake.

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.