cassius Posted November 24, 2013 Share Posted November 24, 2013 Source* source = NULL; Sound* sound = Sound::Load("Sound/gametune.wav"); source = Source::Create(); source->SetSound(sound); source->SetLoopMode(true); source->Play(); I get several syntax errors with above code. Something about "source" type not defined.or int assumed Can anyone see the error. Thanks Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted November 24, 2013 Share Posted November 24, 2013 Did you do #include "Leadwerks.h"? Quote Link to comment Share on other sites More sharing options...
cassius Posted November 24, 2013 Author Share Posted November 24, 2013 Leadwerk.h is included in app.h but not app.cpp.Type missing specifier is one of the error messages. I pasted this code directly from command reference exept for file name. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted November 24, 2013 Share Posted November 24, 2013 Do you have 'using namespace Leadwerks;' anywhere? If not then you'll need to prefix all LE class types with Leadwerks:: like Leadwerks::Source. Quote Link to comment Share on other sites More sharing options...
cassius Posted November 24, 2013 Author Share Posted November 24, 2013 Got it working. I had placed the code in the wrong place. When I moved it to just under app.start it worked.. I really must brush up on this class thing.Thanks for your replies Rick. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted November 24, 2013 Share Posted November 24, 2013 np. You really should just do some tutorials and examples of classes without bringing LE into the picture to get a better understanding of how they work. Then once you do that, the placement and scope and all that will make more sense. Quote Link to comment Share on other sites More sharing options...
Josh Posted November 24, 2013 Share Posted November 24, 2013 You can call Sound::Play for simple stuff like that, FYI. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
cassius Posted November 24, 2013 Author Share Posted November 24, 2013 Is it best to have a separate class for each character or a single "actor" class for all of them? Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted November 24, 2013 Share Posted November 24, 2013 @cassius, there really is no "best". This is a design choice that you have to make. Generally the data you need to different kind of actors will rule this. If it's an RPG type game then it's most likely that all characters will have the same stats/data so you can get away with 1 actor class. Actors will have a list of Abilities where the Ability class will actually do the functionality of the ability and not the actor. With this you will have to assemble actors either via config file or hardcoded. Quote Link to comment Share on other sites More sharing options...
cassius Posted November 25, 2013 Author Share Posted November 25, 2013 My characters all have a "die" animation which is the same for all. I have a separate function for each one. I realize that a single function for all would be better and more consise, but I am still unsure of some aspects of c++ so I keep it as simple as possible. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Rick Posted November 25, 2013 Share Posted November 25, 2013 Yeah, there is a big layer of design that you aren't at yet. I normally make an Animation class and an AnimationManager class that stores a list of Animations. Then on init of the game I setup all animations required. Then I generally link actor states to animations since animations generally don't just play. They play for a reason and that reason is generally an actor state (dying, hurt, idle, running, ect). Now the Actor class is very generic but each actor can be created uniquely as I fill out it's animations, models, other data. 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.