forums

TNT Basic Forums > Programming Q&A
How do you use objects?
< Last Thread     Next Thread >
Author
Thread        Post A Reply

07-09-2003 10:27

Posted by:
JAS

Click Here to Email JAS   Find more posts by JAS

I haven't really done too much research on this, but how do you assign a sprite to an object (placeholder) on the map?

07-09-2003 13:12

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

' I hope I didn't make mistakes! ;)

int length =map object count

int x[length],y[length]

load map 128

for n=0 to length
x[n]=map object x(n)*map tile width
y[n]=map object x(n)*map tile width
next

while execution

for n=0 to length
sprite 1+n,x[n],y[n],3
next

wend

07-09-2003 13:14

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

oh, you'll need a draw frame between the next and the wend.

07-09-2003 20:46

Posted by:
eekaydee

Location:
CA, USA

Click Here to Email eekaydee   Find more posts by eekaydee

You don't really assign sprites to objects, you use the objects to determine the position and type of anything you want; not just sprites.

int object, image, bank, x, y
for object=0 to Map Object Count-1
x=map object x(object)*map tile width
y=map object y(object)*map tile height
if map object type(object)=1
image=0 '<-the image number of the sprite's bank
set image bank object,10
sprite object,x,y,image
else if map object type(object)=2
set pen color black
draw text x,y,"Blah"
end if
next object

if the object type is 1, it will put a sprite where the object was. If the type is 2, it will draw the text "blah" where the object was.

07-09-2003 21:40

Posted by:
JAS

Click Here to Email JAS   Find more posts by JAS

This should help in making games - Thanks!!!

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.