Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (777)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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  
  Changing animation-sequences of sprites  (Read 1800 times)
0 Members and 1 Guest are viewing this topic.
Offline Serethos

Junior Devvie

Java games rock!

« Posted 2004-01-01 19:21:52 »

i have a little problem animating my sprites.
every game-object has several animator-objects
each storing a list of animation-frames for a
special sprite-movement. these animator-objects
can differ through nested classes, so theres one
for looping animation, one for one-shot and so

now imaging my "main-class", my game-manager, which
schedules all game-objects. if an event occurs, e.g.
pressing a key, collision, whatever, the gamemanager
signals it to the game-objects so that they know,
they have to change the animation-strip.

for getting the correct animationstrip there is an
object which gets a reference of the actual animation.
so the animator-object actual_anim is set to shoot_anim,
walk_anim ... whatever shall be returnd for painting
over this dummy.

but now the big problem:
every call to an object that it shall change its animation
is done just in time. imaging a memory card game:
the first "animation" is a card, where you can only see the
deck-motive. after clicking, the card shall turn in a
little animation and then change its animation to a
"heart 8" (or whatever). my program would solve it this way:

animation references to 'hidden_card'
click on card recognized => animation is set to ??
either : open_card   -- now the turn-animation is missing
or     : turn_card   -- no i have to develope a system which
detects when the turn_animation has ended and through which
animation it sould be replaced (it hasnt to be always the same
in all cases)

the turn_animation has no clue, that is going to be replaced.
even if it did so it would not know, which animation should
Offline Jeff

JGO Coder

Got any cats?

« Reply #1 - Posted 2004-01-02 03:59:05 »

Im not exactly sure I understand what your problem is, but what you are describing sounds very much liek a finite state machine (FSM.)

An FSM has static states, and transitions defined that take it from onbe state to another. So your "Covered card" woudl be one state, your flip the transition, and the exposed card the next state.

How you code this is up to you but typically the way it is done is with an anim structure that throws an event when it hist its last frame. Do you start the transition anim, wait for it to throw the doen event and then doe the new-state animation.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!
Pages: [1]
  ignore  |  Print  

hadezbladez (290 views)
2018-11-16 13:46:03

hadezbladez (159 views)
2018-11-16 13:41:33

hadezbladez (291 views)
2018-11-16 13:35:35

hadezbladez (72 views)
2018-11-16 13:32:03

EgonOlsen (2151 views)
2018-06-10 19:43:48

EgonOlsen (2177 views)
2018-06-10 19:43:44

EgonOlsen (1366 views)
2018-06-10 19:43:20

DesertCoockie (1984 views)
2018-05-13 18:23:11

nelsongames (1626 views)
2018-04-24 18:15:36

nelsongames (2273 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!