forums

TNT Basic Forums > Programming Q&A
'if sprite' syntax errors
< Last Thread     Next Thread >
Author
Thread        Post A Reply

07-16-2003 20:33

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

Why do if statements using a sprite as a condition not work? IE.

if sprite 5,320,240
blah, blah
end if

with this in mind, how can do you find out if a sprite is in a certain part of the screen? So instead of the above, which causes syntax errors, something like:

if sprite 5(0-640),(0-480) 'This covers the entire area of the screen
blah, blah
end if

Something like the second code will provide a much more accurate way of telling whether the sprite is on screen or not does anyone have any ideas?

thanks,
Mark_667

07-17-2003 02:40

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

>if sprite 5,320,240
>blah, blah
>end if

if sprite x(5)=320 and sprite y(5)=240
blah blah
end if

>if sprite 5(0-640),(0-480)
>blah, blah
>end if

if sprite x(5)>0 and sprite x(5)<640 and sprite y(5)>0 and sprite y(5)<480
blah blah
end if

Hope this works
Eric

07-17-2003 11:45

Posted by:
mark_667

Location:
England

Click Here to Email mark_667   Find more posts by mark_667

thanks for the idea, it works fine, it would have been quite a head ache trying to find a different work-around. :-)

thanks a lot,
Mark_667

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.