EasyWay Java Game Engine
December 31, 2009, 08:36:05 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to run animation for a specified amount of time.  (Read 502 times)
0 Members and 1 Guest are viewing this topic.
lustyhairman
Newbie
*
Posts: 5


View Profile
« on: October 16, 2008, 01:57:22 AM »

I am making changes to the shooting game in the tutorial. I have created my own explosion .png's called "Explode" and "blank". I want to be able to run the explosion graphic over the Player sprite for only about 3 seconds after a collision. I've written some code but it doesn't work. How do I do this?
Here is my code:
Code:
    protected static Texture image;
    protected static Texture aniImage1;
    protected static boolean shotOnScreen;
    protected static boolean beenDestroyed;
    protected static Animo explode;
   
    private long time;
    private long endTime;

public static void init(){
        if (image!=null){
            return;
        }
       
        image = new Texture("images/player.png", 255, 255, 255);
        new Mask(image);
       
        explode = new Animo();
        aniImage1 = new Texture("images/Explode.PNG", 255, 255, 255);
        explode.add(aniImage1);
        aniImage1 = new Texture("images/blank.png", 255, 255, 255);
        explode.add(aniImage1);
        explode.setSpeed(100000000);
        explode.start();
    }
...
 public void explodeAnimo(){
        animo = explode;
        time = explode.getTime();
        endTime = time + 1000000;
        while ((endTime) > time){
            time = explode.getTime();
        }
        if (endTime <= time)
            explode.stop();
    }
...
    public void onCollision(){
        explodeAnimo();
    }
Logged
lustyhairman
Newbie
*
Posts: 5


View Profile
« Reply #1 on: December 07, 2008, 08:53:57 PM »

Dammit! Someone answer my question! Aaaggggrrhh...
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!