Jump to content

Recommended Posts

Posted

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

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

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.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

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.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

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.

Posted

Is it best to have a separate class for each character or a single "actor" class for all of them?

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

@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.

Posted

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.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

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.

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...