Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (575)
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  
  Two animations, or one?  (Read 2171 times)
0 Members and 1 Guest are viewing this topic.
Offline evilfrenchguy

Junior Duke


Medals: 3



« Posted 2012-02-08 21:02:05 »

Hi all. ^_^ I have a question about animations/sprites.

Say I have a stealth game. In this game, I can sneak up behind guards and stab them/snap their neck/etc.. What is a good way to handle the stabbing death animations with the sprites? It's a little weird because not only does the guard need to be shown getting a knife through the back, but the player needs to cover the guard's mouth and force the dagger through. That's not accounting for different enemies either.

Is there a good OO way to combine the animations? Or, do I really need to make stealth killing animations for each enemy (and if that's the case, how would painting/rendering work)?

Thanks!
Offline theagentd
« Reply #1 - Posted 2012-02-08 21:34:30 »

The easiest way would be to have a single kill animation for the player and and a single "killed" animation for each different enemy. It'll look fine, and you really REALLY want to avoid having to animate all the combinations of killer/enemy...

Myomyomyo.
Offline GabrielBailey74
« Reply #2 - Posted 2012-02-08 21:35:09 »

Example:

Draw your enemy.
Draw your player.
Draw your stealth animation.
Draw OVER your enemy's dieng animation.

If you're doing 2D, you're pretty much going to have to draw out allll of the animations by frame (picture by picture, cycle by cycle).
But you can draw images over certain images, by rendering them before that image (the illusion of your players knife/hand over your enemys sprite).
Hope it helps some mate, need anything drop me a pm.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline sproingie

JGO Kernel


Medals: 202



« Reply #3 - Posted 2012-02-08 23:02:31 »

Ask a friend to wear a bunch of white dots.  Put some on yourself.  MoCap yourself snapping your friend's neck.

Maybe not a friend then.
Offline theagentd
« Reply #4 - Posted 2012-02-09 10:02:26 »

Ask a friend to wear a bunch of white dots.  Put some on yourself.  MoCap yourself snapping your friend's neck.

Maybe not a friend then.

Or just buy a Kinect if you're going to do 3D animation. -_-'

Myomyomyo.
Offline evilfrenchguy

Junior Duke


Medals: 3



« Reply #5 - Posted 2012-02-09 13:28:06 »

Hahaha. Thanks for the tips guys. It is a 2D game. I want to master 2D before I tackle 3D.

Just a curiousity question: why is swing considered slow? Does it open a separate thread for each component or something?
Offline CodeBunny
« Reply #6 - Posted 2012-02-09 14:07:53 »

The rendering is not hardware accelerated, so it's orders of magnitude slower.
Offline BoBear2681

JGO Coder


Medals: 19



« Reply #7 - Posted 2012-02-09 14:26:34 »

The rendering is not hardware accelerated, so it's orders of magnitude slower.

This isn't really true.  Swing uses Java2D, which in turn will be hardware accelerated if possible (and extremely likely on Windows, for example).  "Swing is slow" is a stigma that's unfortunately stuck with Swing for the past 10+ years.  If you're Swing GUI is slow, then you're just not doing it rightTM, just like with any other widget toolkit.

If anything, it'll be your doing non-UI tasks on the EDT that makes your Swing app appear sluggish, not its rendering performance.
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #8 - Posted 2012-02-09 14:30:44 »

The rendering is not hardware accelerated, so it's orders of magnitude slower.

This isn't really true.  Swing uses Java2D, which in turn will be hardware accelerated if possible (and extremely likely on Windows, for example).  "Swing is slow" is a stigma that's unfortunately stuck with Swing for the past 10+ years.  If you're Swing GUI is slow, then you're just not doing it rightTM, just like with any other widget toolkit.

If anything, it'll be your doing non-UI tasks on the EDT that makes your Swing app appear sluggish, not its rendering performance.

Except that Java2D's g.drawImage(...) sucks, performance wise. Even when you're doing it rightTM. It's obvious that's it's either falling back to a software rasterizer or the hardware accelerated pipeline is somehow extremely inefficient. This has nothing to do with whether or not your executing time consuming code on the EDT, this is purely the rendering part: Java2D is slow, and Swing therefore too.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline BoBear2681

JGO Coder


Medals: 19



« Reply #9 - Posted 2012-02-09 15:18:22 »

Perhaps, but it's not slow enough to matter for the vast majority of GUI's most people will throw together.  If your Swing application seems sluggish and you try to blame it on the fact that you're drawing too many JButtons, you really need to get out a profiler.

I'm well aware that games in Java2D cannot compete with OpenGL bindings, but we're talking GUI's here (well, since Swing was brought up, guess we're a little off-topic here).  Perceived performance is all that matters, and the human eye won't be able to detect a speed difference between a JMenu dropping down and a native Win32 one.  Visual fidelity is a different matter though.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 816
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2012-02-09 15:27:11 »

but we're talking GUI's here
No. The author of this thread is purely talking about rendering. When he mentions the 'slowness' of Swing, it's clear it means 'Java2D'.

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
Offline BoBear2681

JGO Coder


Medals: 19



« Reply #11 - Posted 2012-02-09 15:36:16 »

but we're talking GUI's here
No. The author of this thread is purely talking about rendering. When he mentions the 'slowness' of Swing, it's clear it means 'Java2D'.

Fair enough.  The "does it open a thread per component" question made me think he was also looking at Swing proper since games don't usually create more than just a Frame and Canvas.  Sometimes my zealotry gets the better of me.
Offline evilfrenchguy

Junior Duke


Medals: 3



« Reply #12 - Posted 2012-02-09 17:39:42 »

Haha, sorry; didn't mean to start anything. I was wondering is all because I was taught with it and didn't have issues.
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.

Longarmx (34 views)
2014-10-17 03:59:02

Norakomi (25 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (26 views)
2014-10-15 16:18:58

TehJavaDev (50 views)
2014-10-14 00:39:48

TehJavaDev (50 views)
2014-10-14 00:35:47

TehJavaDev (40 views)
2014-10-14 00:32:37

BurntPizza (63 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (74 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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