Jump to content

  • Log In with Google      Sign In   
  • Create Account

MrTwiggy

Member Since 05 Apr 2011
Offline Last Active Jun 22 2012 04:41 PM

Posts I've Made

In Topic: .XNA design Question

12 June 2012 - 11:06 AM

If the only difference between the characters is the values of the member variables, there is no need to create a sub-class for each character type.

You can have a single character class and simply pass in the correct values when you construct it.

Only if the different characters behaved in fundamentally different ways would you need to consider adding classes specific to each character type.


But, say you wanted a multiplayer game. Even if the only thing that differeniates different characters is different values, wouldn't it be better/easier to have unique classes for each character that inherits from the base character class, and then when people are selecting their character, you could set their character type to the class for the unique character, rather than constantly calling functions that are hardcoded in and would set the values for each specific character?

In Topic: .XNA design Question

12 June 2012 - 10:31 AM

I have a question based off the answers given.

Would it be better to have a base character class that has universal members that all would have, texture, position, animations, sounds, move speed, etc.

Then have a different class for each character type that inherits from the base character class, but gives it`s unique values to the members? Would that be the best way?

In Topic: Get sprites sizes and positions from an image

09 August 2011 - 06:33 PM

I'm not sure if I'm understanding right. Do you mean that all of the sprites are different in size, and at random positions? Or do you mean you have multiple textures/animation sprites, each with their own size, and location?

For example:

If you have a character with a run animation and also a jump animation on the same sprite sheet, each with 5 frames. Are the 5 frames for the run animation all the same size, and are next to each other in order, while the jump animation has a different 5 frames, all with the same size, except it is a different size from the run animation, but each are in order? If so, thats a relatively easy fix.

I had something like this before, however the way I structured my animating classes fixed it. Esentially, I had a base Animating class with drawing functions/methods, that was passed in an 'Animation' variable (a seperate class), and the 'Animation' class had its own name for the animation, starting location of the first sprite, number of frames, size, etc. and various other intuitive functions that determined the frames to be used. And all these animation variables were declared inside the Player class (hard coded).

This was in XNA, so I'm not sure if it will work for whatever program your using.

Best of luck.

In Topic: A workable structure for physics?

07 April 2011 - 03:58 PM


Hey. Yeah, I actually did. It's really well done, but unfortunately the C++ portions of it clouded it a bit too much for me to get enough out of it, just because I don't understand the inner-complexities of the actual C++ language. Really great thing though.


The code snippets and examples are actually written in flash :)


Ahh xD I just figured it was really complicated C++, haha.

In Topic: A workable structure for physics?

07 April 2011 - 03:31 PM


When you are controlling player movement, I'm assuming you add a force to the player, correct? Which causes an increase in acceleration, and thus an increase in velocity and position. However, how do I limit the input force, but not the external forces? (Such as riding a train) Because, in these games, the players accelerate, and then they reach a maximum speed. But how do I enable that effectively for the input speed?

EDIT: Also, does anyone know any good tutorials or guides that go in-depth with a 2D rigid body dynamics physics engine? I have found some, but they are almost all in C++, and the inner-working of C++ seem to complicate everything even further. So hopefully something that is either not language specific, or is C# or XNA specific. Thanks.


Did you see my article Physics engines for dummies? Might give you some pointers :)

http://www.wildbunny...es-for-dummies/


Cheers, Paul.


Hey. Yeah, I actually did. It's really well done, but unfortunately the C++ portions of it clouded it a bit too much for me to get enough out of it, just because I don't understand the inner-complexities of the actual C++ language. Really great thing though.

PARTNERS