forums

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

07-24-2006 18:17

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Hi Guys,

Im not sure how to copy a sprite or if there is a way to?, So could anyone give me any advise on this?,

Stephen,

07-24-2006 19:12

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

What do you mean, copy a sprite?

07-25-2006 02:44

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Well i want to have a bunch of trees randomly placed, but only have like three different kinds of trees, and i thought that there probably would be a way to copy the three trees and make a forest,

07-25-2006 14:44

Posted by:
someone

Location:
Quebec ( Canada )

Click Here to Email someone   Find more posts by someone

why don't you display many sprites with the same tree image?
or, if they,re part of the background, just draw them to the background?

i'm still not sure what you mean by 'copy'. All sprites have an image, if you want multiple tree you can use many sprites with the same image?

07-25-2006 16:56

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Is there a way to copy there same sprite over and over. in stead of doing this:

Sprite 128,100,100,0
sprite 128,200,130,0
sprite 128,300,170,0

is there a way to duplicate it sprite?

07-25-2006 17:52

Posted by:
swagIT

Location:
Great Wet North (Vancouver)

Find more posts by swagIT

Why not use a For...Next loop to save code


Global int x
Global int '===== horizontal position
Global int '===== vertical position

set random seed Timer

For x = 128 to 148 '==== however many trees you want
h = random (10,600)
v=random( 10,400)

Sprite x,h,v,0

next x
draw frame

07-26-2006 12:32

Posted by:
Jacob

Location:
San Francisco, CA

Click Here to Email Jacob   Find more posts by Jacob

For x = 0 to 20
Sprite random( 10,400), random (10,600),0
next

draw frame

07-26-2006 17:29

Posted by:
Stephen Lund

Location:
Michigan USA

Click Here to Email Stephen Lund   Find more posts by Stephen Lund

Hmm. Silly me, I should have thought of that. Thats a good idea. 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.