evilfrenchguy
Jr. Member   Posts: 80 Medals: 3
|
 |
«
on:
2012-02-08 16: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!
|
|
|
|
|
theagentd
JGO Wizard     Posts: 1392 Medals: 88
|
 |
«
Reply #1 on:
2012-02-08 16: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...
|
There is no god.
|
|
|
GabrielBailey74
Full Member   Posts: 157 Medals: 2
Owner of Elite Demons R.I.P
|
 |
«
Reply #2 on:
2012-02-08 16: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! Go get 'em!
|
|
sproingie
JGO Strike Force    Posts: 901 Medals: 55
|
 |
«
Reply #3 on:
2012-02-08 18: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.
|
|
|
|
|
theagentd
JGO Wizard     Posts: 1392 Medals: 88
|
 |
«
Reply #4 on:
2012-02-09 05: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. -_-'
|
There is no god.
|
|
|
evilfrenchguy
Jr. Member   Posts: 80 Medals: 3
|
 |
«
Reply #5 on:
2012-02-09 08: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?
|
|
|
|
|
CodeBunny
JGO n00b  Posts: 42 Medals: 4
|
 |
«
Reply #6 on:
2012-02-09 09:07:53 » |
|
The rendering is not hardware accelerated, so it's orders of magnitude slower.
|
|
|
|
|
BoBear2681
Full Member   Posts: 238 Medals: 8
|
 |
«
Reply #7 on:
2012-02-09 09: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 right TM, 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.
|
|
|
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #8 on:
2012-02-09 09: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 right TM, 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 right TM. 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
|
|
|
BoBear2681
Full Member   Posts: 238 Medals: 8
|
 |
«
Reply #9 on:
2012-02-09 10: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! Go get 'em!
|
|
Riven
« League of Dukes » JGO Kernel      Posts: 5871 Medals: 255
Hand over your head.
|
 |
«
Reply #10 on:
2012-02-09 10: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
|
|
|
BoBear2681
Full Member   Posts: 238 Medals: 8
|
 |
«
Reply #11 on:
2012-02-09 10: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.
|
|
|
|
|
evilfrenchguy
Jr. Member   Posts: 80 Medals: 3
|
 |
«
Reply #12 on:
2012-02-09 12: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.
|
|
|
|
|
|