Sprites: Panels/Entities

Posted By: openfire2691

Sprites: Panels/Entities - 09/10/08 04:35

I know this is probably a really simple question with a simple answer, but I have looked for hours and hours and not found anything that can help me. Here's the problem:

I'm making a 2D game which will present each character and enemy as a different sprite. So far, everything has been represented in a panel (player, background, menus, etc). The problem is, I want to have way more than one enemy on screen at a time. The only way I know how to do this is to write out a new panel definition for each enemy and make my script unbearably complex.

Is there some kind of way to create a sprite entity, of which I can just create more instances instead of having to code each individual enemy? Kind of an enemy "class", for a more java-like explanation.
Posted By: Rasch

Re: Sprites: Panels/Entities - 09/10/08 10:23

Use:

pan_create("yourpic.pcx",1);

First is the pic the second value the layer. Look up the manual also!
Posted By: openfire2691

Re: Sprites: Panels/Entities - 09/10/08 15:10

Oh my gosh that's perfect! Thanks! I don't know how I missed that. I've been looking through these forums, AUM magazine, AU resources and the manual for a couple days now and haven't found anything! Thanks for your help.
Posted By: openfire2691

Re: Sprites: Panels/Entities - 09/11/08 04:12

Well I guess that wasn't as perfect as I thought. Now I need to be able to assign a function to each "enemy" panel. That, or I need to be able to create one function to run all of my enemies, but that would require an array whose length will have to vary between 0 and at least 100. I'm assuming the array way would be better. Should I just create a massive array and fill it up as I need to?
© 2024 lite-C Forums