import org.frice.game.Game;
import org.frice.game.anim.move.ForceMove;
import org.frice.game.anim.move.SimpleMove;
import org.frice.game.event.OnClickEvent;
import org.frice.game.event.OnMouseEvent;
import org.frice.game.event.OnWindowEvent;
import org.frice.game.obj.ImageObject;
import org.frice.game.resource.FileImageResource;
import org.frice.game.utils.time.FTimer;

import java.util.Random;

/**
 * Created by ice1000 on 2016/8/15.
 *
 * @author ice1000
 * @since v0.2.1
 */
public class Demo2 extends Game {

	private FTimer timer;
	private Random random = new Random();
	private ImageObject object;

	public static void main(String[] args) {
		new Demo2();
	}

	@Override
	public void onInit() {
		timer = new FTimer(10000);
		setSize(800, 800);
		object = new ImageObject(new FileImageResource("test.png"), 0, 620);
		object.getAnims().add(new ForceMove(0, 10));
		object.getAnims().add(new SimpleMove(0, -600));
		object.getAnims().add(new SimpleMove(100, 0));
		addObject(object);
//		setBack(new FileImageResource("test.png"));
		setRefreshPerSecond(40);
	}

	@Override
	public void onExit() {
		System.exit(0);
	}

	@Override
	public void onRefresh() {
//		try {
//			if (timer.ended()) {
//				object.getAnims().clear();
//				object.getAnims().add(new SimpleMove(random.nextInt(180) - 90, random.nextInt(180) - 90));
//				object.getAnims().add(new ForceMove(random.nextInt(180) - 90, random.nextInt(180) - 90));
//			}
//		} catch (Exception ignored){
//		}
	}

	@Override
	public void onClick(OnClickEvent e) {

	}

	@Override
	public void onMouse(OnMouseEvent e) {
	}

	@Override
	public void onLoseFocus(OnWindowEvent e) {
		setPaused(true);
	}

	@Override
	public void onFocus(OnWindowEvent e) {
		setPaused(false);
	}
}

@@ -327,75 +327,8 @@
 rce;
-%0Aimport org.frice.game.utils.time.FTimer;%0A%0Aimport java.util.Random;
 %0A%0A/*
@@ -447,100 +447,8 @@
  %7B%0A%0A
-%09private FTimer timer;%0A%09private Random random = new Random();%0A%09private ImageObject object;%0A%0A
 %09pub
@@ -543,37 +543,8 @@
 ) %7B%0A
-%09%09timer = new FTimer(10000);%0A
 %09%09se
@@ -558,24 +558,36 @@
 00, 800);%0A%09%09
+ImageObject 
 object = new
@@ -814,56 +814,8 @@
 t);%0A
-//%09%09setBack(new FileImageResource(%22test.png%22));%0A
 %09%09se
@@ -940,316 +940,8 @@
 ) %7B%0A
-//%09%09try %7B%0A//%09%09%09if (timer.ended()) %7B%0A//%09%09%09%09object.getAnims().clear();%0A//%09%09%09%09object.getAnims().add(new SimpleMove(random.nextInt(180) - 90, random.nextInt(180) - 90));%0A//%09%09%09%09object.getAnims().add(new ForceMove(random.nextInt(180) - 90, random.nextInt(180) - 90));%0A//%09%09%09%7D%0A//%09%09%7D catch (Exception ignored)%7B%0A//%09%09%7D%0A
 %09%7D%0A%0A
@@ -990,17 +990,16 @@
 nt e) %7B%0A
-%0A
 %09%7D%0A%0A%09@Ov

simplify demo