Creating the enemy entities

Blitz3D Forums/Blitz3D Programming/Creating the enemy entities

SkyCube(Posted 2005) [#1]
Hello everyone,

I am creating a rather simple game (player-ship-destroys-aliens kind of thing) but I am having trouble creating the enemy entities. The enemy entities will be placed using random coordinates. Generating the coordinates is no problem, but how do I go about loading the .3ds mesh that will represent the enemies? I tried creating a custom type with a Field in which to save the mesh, but when I tried to Position it, I got an "Illegal conversion error" or something? Also, is there a way to create them without calling LoadMesh for every enemy? I think loading the mesh so many times is ineffective. Thanks.


fall_x(Posted 2005) [#2]
Use copymesh().
I've had some minor problems with it though, but normally it shouldn't be a problem.

And if you want to know what you're doing wrong with the types and the error you were getting, please post some code.


_PJ_(Posted 2005) [#3]
Yeah something similar to this:




jfk EO-11110(Posted 2005) [#4]
Somebody reported collision problems with enemies made of CopyEntity. Unless you plan to load hundreds if enemies, you shouldn't worry too much about the LoadAnimMesh usage, all in all it will be only a few seconds more.


fall_x(Posted 2005) [#5]
The problem I had with copymesh, was that my trees (which have an alpha and transparant texture, and a solid texture) weren't displayed properly, the alpha+transparant textured polygons (the leaves) weren't displayed all the time, they kept desappearing when they still should have been visible. When sipmly using loadmesh(), they were displayed correctly.
So you should try copying them, but if you're having problems with that, you should change it back to loading them all :)


Ross C(Posted 2005) [#6]
Copymesh only copies the mesh. It doesn't copy the textures or alpha or bones or anything else. The way i understand the entity system, is the mesh is a child of the entity. The properties for that mesh are contained within the entity structure. So, copyentity should copy everything you need.


_PJ_(Posted 2005) [#7]
*stupid grin* I knew that! Updated my little codey thingy up there!


SkyCube(Posted 2005) [#8]
I think I will stick to using LoadMesh for all enemies, just to be on the safe side! Thanks!