Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (604)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (654)
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  
  Behavior question  (Read 1160 times)
0 Members and 1 Guest are viewing this topic.
Offline esvxm

Senior Newbie

Java games rock!

« Posted 2004-02-03 17:13:34 »


I want to use TimeElapsed behavior or FrameElapsed behavior or any other method. What I want to do is that if a specific time has passed e.g. 2000milsec, I run a bit of code, when 2500 milsec pass I run an other. How could this be achieved?. Thanks.
Offline rdcarvallo

Senior Devvie

Projects: 5
Exp: 15 years

2D Java games forever!

« Reply #1 - Posted 2004-02-03 18:23:11 »

 What are you triying to do??
 What does the bit of code? add shapes?? change colors?? (anything that changes the scene) or other things.. (I/O to file)
 If the code changes the Scene you MUST use behavior (and set the capabilities needed), else you can use Threads to make the code run in steps.

 If you want to use behaviors to make your code time dependant use TimeElapsed behaviors..

 Read the Java3D Tutorial from Sun, it's really easy to understand..

Offline Breakfast

Senior Devvie

for great justice!

« Reply #2 - Posted 2004-02-03 19:16:25 »

Create a behaviour that runs using the WakeupOnElapsedTime as it's wakeup criterion. Should be fairly easy.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline esvxm

Senior Newbie

Java games rock!

« Reply #3 - Posted 2004-02-03 23:48:06 »


Thanks for the reply. I am using the TimeElapsedBehavior. What I am trying to do is animate an articulated figure. I have the various ranges and transforms setup. What I want to do is move the right leg, then after a little delay, the left arm moves, so that the character is animated. I am not sure if the ElapsedFrame or the postFrame could be used. Thanks
Offline zingbat

Senior Devvie

Medals: 1

Java games rock!

« Reply #4 - Posted 2004-02-05 20:19:56 »

I guess you dont want to use a third-party api for your animations and instead want to learn how to do it yourself.

If that is the case then it would be important to know how are you modeling your animation data.
I know some ways, maybe one of them is similar to what you are doing and all of them require the use of a skeleton which is just an hierarchy of transforms. If you want to be compatible the standards check the h-anim site and name your transforms accordingly to their convenction.

About the data you could attach a piece of data to each transform (bone). It can be physical data like a force vector being applyed at certain transform. It can also be anim data, a table that associates relative time values with with a certain transformation matrix (mostly rotations). I supose you use the timeline method.
In this case its neccessary to register the absolute time when the animation starts (for instance when the forward key is pressed read current time and associate it with the start of your current animation) then wait until a frame is going to be rendered and based on the time passed after the animation started and the current time choose the required matrix for each of your bones.
To simplify things you should allow only one animation to be played at a time, otherwise you will need to create a blending process somehow.
Offline esvxm

Senior Newbie

Java games rock!

« Reply #5 - Posted 2004-02-06 22:02:13 »


What other API I could use? Also is there any way to use the inverse kinematics, to calculate the joint angles and then put them in the animation file so that it looks more realistic?.
Offline zingbat

Senior Devvie

Medals: 1

Java games rock!

« Reply #6 - Posted 2004-02-07 20:45:11 »

Check the "Character Animation" thread in this part of the  forums. There is also the which has a very complete library of java3d classes available for download.

I don't know if its worth to use inverse kinematics unless you are making a 3d modeler, but of course you could use any technique with java3d as long you know the maths for it. I don't know it myself and its not required at all to do animations. In fact it may even slow down your code considerably if you're thinking of a game.
Offline esvxm

Senior Newbie

Java games rock!

« Reply #7 - Posted 2004-02-08 15:06:17 »

you could use any technique with java3d as long you know the maths for it

I am new to Java3D...can you plz mention where at these classes are..

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

bilznatch (18 views)
2015-08-04 11:03:17

SHC (38 views)
2015-08-01 03:58:20

Jesse (24 views)
2015-07-29 04:35:27

Riven (44 views)
2015-07-27 16:38:00

Riven (25 views)
2015-07-27 15:35:20

Riven (27 views)
2015-07-27 12:26:13

Riven (18 views)
2015-07-27 12:23:39

BurntPizza (40 views)
2015-07-25 00:14:37

BurntPizza (48 views)
2015-07-24 22:06:39

BurntPizza (33 views)
2015-07-24 06:06:53
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 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!