• 大小: 5.47MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-23
  • 语言: Java
  • 标签:

资源简介

Java实现愤怒的小鸟AngryBirds游戏源码,可以直接运行!

资源截图

代码片段和文件信息

/*
 * To change this template choose Tools | Templates
 * and open the template in the editor.
 */
package AngryBirdsApplication;

import AngryBirdsCharacters.AngryBirdsBodyInfo;
import java.awt.Color;
import java.awt.Graphics2D;
import java.util.ArrayList;
import java.util.linkedList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;
import org.jbox2d.callbacks.QueryCallback;
import org.jbox2d.collision.AABB;
import org.jbox2d.common.Vec2;
import org.jbox2d.dynamics.*;
import org.jbox2d.collision.shapes.*;
import org.jbox2d.dynamics.joints.*;

/**
 *
 * @author Sumomoxiao
 */
enum QueueItemType {

    MouseDown MouseMove MouseUp KeyPressed KeyReleased
}

class QueueItem {

    public QueueItemType type;
    public Vec2 p;
    public char c;
    public int code;

    public QueueItem(QueueItemType t Vec2 pt) {
        type = t;
        p = pt;
    }
    
}

class FixtureQueryCallback implements QueryCallback {

    public final Vec2 point;
    public Fixture fixture;

    public FixtureQueryCallback() {
        point = new Vec2();
        fixture = null;
    }

    /**
     * @see
     * org.jbox2d.callbacks.QueryCallback#reportFixture(org.jbox2d.dynamics.Fixture)
     */
    public boolean reportFixture(Fixture argFixture) {
        Body body = argFixture.getBody();
        if (body.getType() == BodyType.DYNAMIC) {
            boolean inside = argFixture.testPoint(point);
            if (inside) {
                fixture = argFixture;

                return false;
            }
        }

        return true;
    }
}

public abstract class AngryBirdsArea {

    private MouseJoint mouseJoint;
    private Vec2 mouseWorld = new Vec2();
    public final World sworld;
    private final Vec2 gravity;
    public Vec2 slingAnchor;
    public ArrayList birdlist;
    public ArrayList oblist;
    public ArrayList piglist sling;
    public WeldJoint attach;
    public WeldJointDef attachDef;
    public Body ground;
    public float scale = 1 / 64f;
    float timeStep = 1.0f / 60.0f;
    int velocityIterations = 6;
    int positionIterations = 2;
    public int birdbullets;
    private final linkedList inputQueue;

    public AngryBirdsArea() {
        gravity = new Vec2(0 -10f);
        inputQueue = new linkedList();
        sworld = new World(gravity true);
        birdlist = new ArrayList();
        oblist = new ArrayList();
        piglist = new ArrayList();
        sling = new ArrayList();
        slingAnchor = new Vec2();

    }

    abstract public void initStage();
    long endtime = 0;
    long duration = 0;  //duration of release the bird;
    long descountdown = 0;
    public void step() {
        
        sworld.step(timeStep velocityIterations positionIterations);
        
        if (mouseJoint == null && attach ==

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-09-10 10:17  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\
     目录           0  2013-09-10 10:17  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\
     文件         389  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\.classpath
     文件         386  2013-09-10 09:45  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\.project
     目录           0  2013-09-10 10:17  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\.settings\
     文件         629  2013-09-10 09:45  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\.settings\org.eclipse.jdt.core.prefs
     目录           0  2013-09-10 10:17  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\
     文件        6148  2013-09-10 09:45  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\.DS_Store
     目录           0  2013-09-10 10:17  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\
     文件        7549  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsArea.class
     文件        1677  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsController$1.class
     文件        1793  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsController$2.class
     文件        5021  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsController.class
     文件        8982  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsDraw.class
     文件        2149  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsMain.class
     文件        5055  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsMenu.class
     文件        3432  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsMenuController.class
     文件        1205  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsPanel$1.class
     文件        1396  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsPanel$2.class
     文件        2392  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsPanel$3.class
     文件        6251  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsPanel.class
     文件        2650  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsPanelController.class
     文件        2502  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsViewframe.class
     文件        3088  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\AngryBirdsViewportTransform.class
     文件        1137  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\FixtureQueryCallback.class
     文件         395  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\GameButton.class
     文件         568  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\QueueItem.class
     文件        1221  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsApplication\QueueItemType.class
     目录           0  2013-09-10 10:17  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsCharacters\
     文件        2047  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsCharacters\AngryBirdsBodyInfo.class
     文件        2316  2013-09-10 09:46  [www.java1234.com]Java实现愤怒的小鸟AngryBirds\AngryBirds\bin\AngryBirdsCharacters\AngryBirdsCharacter.class
............此处省略97个文件信息

评论

共有 条评论

相关资源