TheConceptBoy Posted June 9, 2019 Author Share Posted June 9, 2019 cZombie()? How does that fix the damn thing? I saw that c prefix in your own BasrActor file you posted but I figured that was just you personal naming convention. Is this some sort of a special modifier? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 9, 2019 Share Posted June 9, 2019 Ah sorry it's how I name my class as sometimes I want a class that conflicts with Leadwerks classes. Did it work? Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 9, 2019 Author Share Posted June 9, 2019 yeah, it did. What it he god damn hell did you do besides renaming the class to cZombie? xD Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 9, 2019 Author Share Posted June 9, 2019 wait... is there already a class zombie in the leadwerks source files? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 9, 2019 Share Posted June 9, 2019 Unfortunately it wasn't that simple. I don't know how it happens but sometimes the file gets corrupted. I opened the header file in a Hex Editor so I could see every byte of info and found these funny symbols (circled in red). After removing those it compiled fine Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 9, 2019 Share Posted June 9, 2019 Obviously the text editors couldn't see it, but the compiler could. Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 9, 2019 Author Share Posted June 9, 2019 Ah, great. So there was literally no way an inexperienced C++ programmer would have ever been able to guess that one. Well at least I know now. Any ideas if it was VS that caused it? Or perhaps the internet browser is designed to add scramble to potentially harmful files? Notice how the cpp file transfered ok but the .h file had all sort of a mess added to it's suffix? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 9, 2019 Share Posted June 9, 2019 I'd say it was VS. A few years ago I had a similar issue. I think how I solved it was I just deleted all the white spaces between the functions and the error was solved. Luckily it wasn't a big class. Another thing I've noticed with VS, sometimes it will say you have an error but it will compile and run fine. I think this is the intellisense kicking the bucket - the only way I've found to fix that is to restart VS. Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 9, 2019 Author Share Posted June 9, 2019 Can we use an alternative to VS? Do we have to use VS? You seem to also be able to run the code from within the LW Level Editor. And the Built in code editor can also open cpp and h files Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 9, 2019 Author Share Posted June 9, 2019 Now that I've gotten a single instance of the zombie class spawned, which, now that I've gotten a hang of it, was pretty damn straight forward. Thank you for the help and patience btw 1) Creating a proverbial horder of zombie instances would require creating an array based on the actor entity class and storing all the zombies in that array? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 9, 2019 Share Posted June 9, 2019 35 minutes ago, TheConceptBoy said: Can we use an alternative to VS? Do we have to use VS? VS has a lot of good debugging tools. Personally, despite some of the things that can go wrong with it, I would use it over the internal editor. 29 minutes ago, TheConceptBoy said: Thank you for the help and patience btw Welcome 29 minutes ago, TheConceptBoy said: Now that I've gotten a single instance of the zombie class spawned, which, now that I've gotten a hang of it, was pretty damn straight forward. Thank you for the help and patience btw 1) Creating a proverbial horder of zombie instances would require creating an array based on the actor entity class and storing all the zombies in that array? How I would go about it is load 100 zombies in an Entity* array. Then assign each entity a ZombieActor class. Inside your ZombieActor class you make it control each entity. E.g. In UpdateWorld() you would check the distance to the player, if the payer is close you make it attack. Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 9, 2019 Author Share Posted June 9, 2019 8 hours ago, Lethal Raptor Games said: How I would go about it is load 100 zombies in an Entity* array. Then assign each entity a ZombieActor class. Inside your ZombieActor class you make it control each entity. E.g. In UpdateWorld() you would check the distance to the player, if the payer is close you make it attack. Ah, so far the array created with the Entity class method was the correct procedure. So that part lines with with the standard C++ game dev procedure. And I take it, then you can address each zombie in that array by using it's id in the entity array slots then? 2 Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 9, 2019 Author Share Posted June 9, 2019 Oh and from this point on, we are loading models and meshes inside the zombie actor class on Attach() right? When we detach, I believe I read somewhere that the engine handles removal of created instances automatically? Models. Sounds, Physics, Shapes? Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted June 9, 2019 Share Posted June 9, 2019 5 hours ago, TheConceptBoy said: Oh and from this point on, we are loading models and meshes inside the zombie actor class on Attach() right? When we detach, I believe I read somewhere that the engine handles removal of created instances automatically? Models. Sounds, Physics, Shapes? The best way is to load them outside of the actor class. Then you attach the actor to each loaded zombie entity. If you load them in the Attach function you would have to create a separate object (maybe a pivot) and assign the actor class to that pivot so that the actor functions are called. Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 10, 2019 Author Share Posted June 10, 2019 4 hours ago, Lethal Raptor Games said: The best way is to load them outside of the actor class. Then you attach the actor to each loaded zombie entity. If you load them in the Attach function you would have to create a separate object (maybe a pivot) and assign the actor class to that pivot so that the actor functions are called. Really? I figured the whole deal with using the Actors is that you can just handle all the zombie related stuff IN the actual zombie when it's created... like Load the sounds, load the Model, load the animations, textures, materials and what not - everything related to the zombie. Instead it's like you're but a stone throw away from just doing it with your own class and not using Leadwerks Actor.. The hooks are useful though. I know that you should probably only load up the zombie 3D model once and instance it to all the actors. You really don't need to have 40 spawned zombies ALL load the model right? You can probably just Load the model once in the engine and then have the various zombies use that one loaded mode. Am I thinking this right? Say if I load the Model in the main.cpp, can the zombie actor class access the model variables located in the main file? I know I can set the zombie model when I create the zombies in the main.cpp file, but I'd love to be able to just leave ALL zombie related code in the zombie, including the model assignment. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.