Liberty BASIC Community Forum
« Simple way to use many sprit? »

Welcome Guest. Please Login or Register.
Feb 22nd, 2018, 05:03am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Simple way to use many sprit?  (Read 63 times)
Ronald68
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx Simple way to use many sprit?
« Thread started on: Feb 13th, 2018, 6:22pm »

Lets say i want to make a star map and use the star sprite many time on that map.


Is there simple way to load and display the same sprite with out write every command line.

For this test i just load 10 smiley
Tryed but it only show 1 smiley and moves it to other part of screen.



dim newsmiley(10):global e

spriteX = 10 : spriteY = 30

for e= 1 to 10
#main.g "addsprite newsmiley(e) smiley"
#main.g "spritexy newsmiley(e) ";spriteX;" ";spriteY

spriteX=spriteX +100 :

#main.g, "drawsprites" 'update screen
next e


huh huh huh huh huh

(I need it to be sprite because it blend better with background and i shall click on it so it gives me information)
User IP Logged

Brandon Parker
Board Moderator

member is offline

Avatar




PM

Gender: Male
Posts: 1127
xx Re: Simple way to use many sprit?
« Reply #1 on: Feb 13th, 2018, 8:29pm »

You need to pull the iterative variable outside of the command string and allow Liberty BASIC to evaluate the string and concatenate the variable into the command string.

Code:
dim newsmiley(10):global e

spriteX = 10 : spriteY = 30

for e= 1 to 10
#main.g "addsprite newsmiley(";e;") smiley"
#main.g "spritexy newsmiley(";e;") ";spriteX;" ";spriteY

spriteX=spriteX +100 :

#main.g, "drawsprites" 'update screen
next e 



{:0)

Brandon Parker
User IP Logged

Windows 7 Home Premium 64-bit Intel(R) Quad Core(TM) i5 CPU M 430 @ 2.27GHz 4GB DDR3 RAM
Ronald68
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx Re: Simple way to use many sprit?
« Reply #2 on: Feb 14th, 2018, 05:02am »

LOL

Thanks alot, hoples be new lol.

User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls