Jump to content

stntax error?


cassius
 Share

Recommended Posts

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++

Link to comment
Share on other sites

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++

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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++

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...