Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 27 Jun 2001
Offline Last Active Apr 30 2015 09:40 AM

Posts I've Made

In Topic: Help with Jumping mechanic?

30 April 2015 - 09:27 AM

What L. Spiro said is the right way to do it.  For a simplistic approach, the way I would go about it is, every frame, you'll want to have gravity act on all movable objects, meaning, the y-velocity of all objects gets the gravity velocity added to it.  If the gravity moves an object onto (or into) another object, reset the objects y-location (or place it directly above the object it hit).


When a player jumps, you can check if gravity has already found out the player is on the ground/on an object (by it having tried to move it down, and it failed because the player was already on an object), and, if so, allow jump (basically, just set the player's y-velocity to your initial jumping velocity).


If jumping (or just falling off a platform), since gravity is always moving your objects down, there is no special checks for IsJumping, IsOnGround, etc., your objects will always have it's y-velocity decreased, and eventually go negative, back towards the earth automatically, until it hits something in the y direction.


Be careful about your collisions as well.  You don't want your player to stop moving in the y-direction if he hits a wall in the x-direction.  Typically, you want to move a player in one direction, check for collisions, handle collisions, and then move and check in the other axis.  This way, if you're jumping and moving right and you hit a wall, you'll move in the x-direction, see you've hit a wall, reset your x-position, then move in the y-direction, no collision, and update the y-position.

In Topic: How to implement skeletal animation in 2d game?

31 March 2015 - 07:40 PM


And i prefer doing stuff myself instead of using third party technology.(I have the NIH virus)


So... you're the inventor of Allegro?


He's writing it in x86 machine code.  NIH indeed!

In Topic: How to implement skeletal animation in 2d game?

31 March 2015 - 09:46 AM

Check out spriter as well, it's seem very useful.

In Topic: How best to represent data required for static and animated sprites?

26 March 2015 - 08:41 AM

Couldn't a static sprite be represented as an animation with a single frame?  With that in mind, create an object that can hold your list of sprites, and the duration each sprite should be shown before moving to the next sprite.  For a static sprite the list would be 1 long, and the duration would be unimportant.


Although, I'm not sure that's what you really should send to an view, since you really should just give the view the sprites it needs to display NOW, which would be the proper sprite at it's current animation state, but I can't really say that since I'm not familiar with your framework.


Good luck!

In Topic: Card game Class Structure

19 March 2015 - 07:55 PM

Thank you very much for the responses everybody! Since i am quite new to this topic (and to programming in general), what would be the correct terms to Google for an example or maybe even a tutorial in C# for a compositional approach?

I think that's going to be the crux of the issue.  Building objects using components, and properly operating on them isn't as easy to grasp as some other methodologies, and, since you're a beginner, it's going to complicate the issue.


I don't know C# very well, but if you google "c# entity component system" you're bound to find a bunch of information to help you along.  Read as much as you can, and try to understand what's going on.


I believe it's going to be tough for you.  You might want to start simple, and limit the number of "options" of your cards, and make a simple, but fun, card based game.  Then, as you grow into game programming, you can build.


You're going to make mistakes, you're going to do things the wrong way, but you'll learn from it.  Read, program, and repeat, you'll get there.


Good luck!