91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.67MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-08-31
  • 語言: Java
  • 標簽:

資源簡介

一個類似超級瑪麗界面和玩法的Java游戲,并不是真正的超級瑪麗,也算是學編程這么長時間的一點總結吧,想學習Java游戲的朋友可要好好研究一番了,還帶有音效,相信你會從中學到不少知識的。

資源截圖

代碼片段和文件信息

package?com.brackeen.javagamebook.graphics;
//Download?by?http://www.codefans.net
import?java.awt.Image;
import?java.util.ArrayList;

public?class?Animation?{

????private?ArrayList?frames;
????private?int?currframeIndex;
????private?long?animTime;
????private?long?totalDuration;


????/**
????????Creates?a?new?empty?Animation.
????*/
????public?Animation()?{
????????this(new?ArrayList()?0);
????}


????private?Animation(ArrayList?frames?long?totalDuration)?{
????????this.frames?=?frames;
????????this.totalDuration?=?totalDuration;
????????start();
????}


????/**
????????Creates?a?duplicate?of?this?animation.?The?list?of?frames
????????are?shared?between?the?two?Animations?but?each?Animation
????????can?be?animated?independently.
????*/
????public?object?clone()?{
????????return?new?Animation(frames?totalDuration);
????}


????/**
????????Adds?an?image?to?the?animation?with?the?specified
????????duration?(time?to?display?the?image).
????*/
????public?synchronized?void?addframe(Image?image
????????long?duration)
????{
????????totalDuration?+=?duration;
????????frames.add(new?Animframe(image?totalDuration));
????}


????/**
????????Starts?this?animation?over?from?the?beginning.
????*/
????public?synchronized?void?start()?{
????????animTime?=?0;
????????currframeIndex?=?0;
????}


????/**
????????Updates?this?animation‘s?current?image?(frame)?if
????????neccesary.
????*/
????public?synchronized?void?update(long?elapsedTime)?{
????????if?(frames.size()?>?1)?{
????????????animTime?+=?elapsedTime;

????????????if?(animTime?>=?totalDuration)?{
????????????????animTime?=?animTime?%?totalDuration;
????????????????currframeIndex?=?0;
????????????}

????????????while?(animTime?>?getframe(currframeIndex).endTime)?{
????????????????currframeIndex++;
????????????}
????????}
????}


????/**
????????Gets?this?Animation‘s?current?image.?Returns?null?if?this
????????animation?has?no?images.
????*/
????public?synchronized?Image?getImage()?{
????????if?(frames.size()?==?0)?{
????????????return?null;
????????}
????????else?{
????????????return?getframe(currframeIndex).image;
????????}
????}


????private?Animframe?getframe(int?i)?{
????????return?(Animframe)frames.get(i);
????}


????private?class?Animframe?{

????????Image?image;
????????long?endTime;

????????public?Animframe(Image?image?long?endTime)?{
????????????this.image?=?image;
????????????this.endTime?=?endTime;
????????}
????}
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

-----------?---------??----------?-----??----

??????????????1930881????????????????????135


評論

共有 條評論

相關資源