Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / [SOLVED] What is the correct use of sprite numbers?

Author
Message
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 19th Oct 2021 15:40 Edited at: 19th Oct 2021 15:40
I noticed that when I load in sprites and add them sprite numbers , then I also load in sprites with just names the program will get confused a lot.

So I load in the numbers first then the named sprites and it looks like there is not much more confused problems, but they still exist.

So what is everyone's practice for loading sprites do you just number each one or do you also name some?

There are some added programs that use functions that load in sprites with names and some that load in sprites with numbers so I guess it all depends on what you use.

The author of this post has marked a post as an answer.

Go to answer

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 19th Oct 2021 15:50
What do you mean by named sprites? Sprite IDs are only assigned by an integer.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 19th Oct 2021 16:03 Edited at: 19th Oct 2021 16:04
spikes=1171
createsprite(spikes,spiked)

that is a numbered sprite

rope_1=createsprite(0)

that is a not numbered sprite that the system numbers its self. rope_1 is its name not a number.
hendron
8
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 19th Oct 2021 16:13
rope_1 is an integer variable, same as spikes. The only difference is AppGameKit automatically assigned its value, whereas you manually assigned the spikes variable. If you try Print(rope_1), you'll see it's just a number.
Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 19th Oct 2021 16:24 Edited at: 21st Oct 2021 14:53
hendron

I understand this fact, I'm not asking what is a system assigned sprite to what is not.

What I'm asking is what' most peoples practice in loading sprites because my program has a couple problems figuring out what sprite is what in some of my program.

That is a bug in the system [Mod Edit] No, it isn't. It's a bug in your code

if I say rocks=1 to 100 then I load in just named sprites the system changes my rock numbers to something else.
hendron
8
Years of Service
User Offline
Joined: 20th Dec 2015
Location:
Posted: 19th Oct 2021 16:30
This post has been marked by the post author as the answer.
I see. That's not a bug in AGK. It's doing exactly what you're telling it to do (each iteration of the for loop assigns rocks the next number between 1 and 100). You're not actually keeping track of the sprite IDs. You'd want to use an array in this case.

Game_Code_here
3
Years of Service
User Offline
Joined: 2nd Jun 2020
Location:
Posted: 19th Oct 2021 17:28
hendron

I have a array set up but was not using it for everything like I should.

thanks for pointing this out.

my program is not getting confused any more.

Login to post a reply

Server time is: 2024-04-19 11:13:48
Your offset time is: 2024-04-19 11:13:48