Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (563)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [SOLVED] libGDX animation issue  (Read 1072 times)
0 Members and 1 Guest are viewing this topic.
Offline cheatsguy

Junior Member


Medals: 3


Gamer turned Pixel Artist turned Programmer


« Posted 2012-12-29 21:15:04 »

Hello everyone, I'm using libGDX for my current game and I've encountered a problem. I have an animation with 12 frames that works perfectly, changing frames every 40 milliseconds, and I have a separate sprite for the main character's arm. The problem is, I want the arm to move up and down as the player's animation 'bounces'. I can't have the arm as part of the sprite because of the nature of the game. Any help or suggestions would be wonderful, as I haven't found anything useful through google.

Busy between school, work, life, games, programming and general screwing around.
If you'd like some pixel art for your game, send me a PM, i'll see what I can do.
Current project: http://elementalwarblog.wordpress.com/
Offline ReBirth
« Reply #1 - Posted 2012-12-30 02:10:11 »

What do you mean by "can't have the arm as part of the sprite"?

Oh well let's assume you can't put the arms into your Animation class. Then you need a class that holds your current animation and arm sprites. On its act() check the condition and adjust the arms relatively to animation's position.

Hope help.

Offline cheatsguy

Junior Member


Medals: 3


Gamer turned Pixel Artist turned Programmer


« Reply #2 - Posted 2012-12-30 04:45:43 »

The arm is a separate 'sprite' class that rotates based on the location of the mouse, which would make for hundreds of different player animations if I were to unite them. Currently I am trying to use the state time (time since the application opened) to judge where the arm should be (relative to the animation) but this doesn't work, for some strange reason. Is this helpful for understanding? What I really need is a 'return current frame as an integer' method, so I'm not sure how to go about doing this, or if I should give up on having the arm separate.

Busy between school, work, life, games, programming and general screwing around.
If you'd like some pixel art for your game, send me a PM, i'll see what I can do.
Current project: http://elementalwarblog.wordpress.com/
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ReBirth
« Reply #3 - Posted 2012-12-30 04:53:56 »

Yap my previous solution should still apply. Basically you manage two sprite, one is animating (the body, change due to movement behavior) and one other is the arm (rotating due to mouse behavior). What you have to do are let them update themselves according each own behavior, then adjust the arm position to body sprite.

Offline Nate

JGO Kernel


Medals: 147
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #4 - Posted 2012-12-30 07:21:49 »

You'll have to just position the arm based on the time you pass to the animation. You could use something like Spine, though it isn't ready yet (link in my signature).

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

radar3301 (12 views)
2014-09-21 23:33:17

BurntPizza (30 views)
2014-09-21 02:42:18

BurntPizza (19 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (27 views)
2014-09-20 20:14:06

BurntPizza (31 views)
2014-09-19 03:14:18

Dwinin (48 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!