Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


GKANG

Member Since 19 Apr 2012
Offline Last Active Feb 22 2013 08:13 PM

Posts I've Made

In Topic: Issues with animating for a durating, relative to game loops?

16 February 2013 - 09:36 PM

I've been getting bogged down by being referred to THE BEST GAME LOOPS EVER which are extremely accurate yet way over the top for what I need. Honestly for what I'm doing it just needs to be a super simple, rigid grid-based movement with somewhat smooth motion when moving between tiles (interpolation).

 

I was just getting the gist of your frames class, so ignore anything I've said about my own game loop since I don't really know much about them and my implementation is broken anyway. How can I set it up so that it uses frames instead of time? I really just want a game tick which is x length of time, so then I can base everything off of the tick. So like, walking one tile could take 4 ticks, running takes 2 ticks, fade to black when transitioning somewhere could take 10 ticks, auto-regen health starts after idling for 5 ticks.. Basically a solid variable which I can use to control how long everything is taking, which works alongside your nice little class. I would cry happy tears.

 

I really appreciate the help you're offering by the way, it means a lot. I hope I'm being clear with what I want to achieve so you don't end up explaining things that I have 'no interest in'.


In Topic: Issues with animating for a durating, relative to game loops?

15 February 2013 - 10:45 PM

Yeah I think I get the concept now, you're really helping me out. I also like and understand your idea of doing it backwards, since you're always going to end exactly at the destination and any leftover decimal value would be lost at the start / during the movement instead of being left at the end right?

 

I'm not 100% comfortable with handling time yet, and knowing exactly how fast my program is running. I think if I make a clock then do dt = clock.restart() (which also returns the current elapsed time) in my game loop then I'll know how fast my loop runs? Bah.


In Topic: Issues with animating for a durating, relative to game loops?

15 February 2013 - 09:41 PM

So if I understand exactly what's going here..
 

2vchmxc.png

 

The values aren't identical but is the theory correct? The player moves left 32px to the targetTile, then move back to the original position -4px, then back etc, to give the effect that the whole time the sprite was just moving at a steady -4px rate? Interpolation is where I get lost off but your walkthrough just now may have made it clear what's going on, with the whole wavey pattern thing.


In Topic: Issues with animating for a durating, relative to game loops?

14 February 2013 - 06:56 PM

I think I understand all but one part of the function:
      sprite.y = tileYPosToScreenYPos(tileY);
      sprite.x = tileXPosToScreenXPos(tileX);
What exactly are these functions doing?

Also, FRAMES_FOR_SINGLE_TILE_MOTION would be the number of frames for a single animation cycle and STEPPING_FRAME_DISTANCE would be the width of a tile (16px)?

In Topic: Issues with animating for a durating, relative to game loops?

14 February 2013 - 06:06 PM

Isn’t that contradictory with your original statement that during these little animations the player has no control?
This is supposed to be an automatic movement by the character, yes?

Sorry for the confusion, you're correct. I just tried to think of some example where the direction would basically choose an operator and an axis (+/-, y/x) and not necessarily hold its own value like your example seems to.

Khatharr thanks a ton for posting that class. I'll read over it a few times to make sure I understand.

PARTNERS