资源简介

actionscript for multiplayer Games and virtual worlds_源码(下半部)

资源截图

代码片段和文件信息

package com.gamebook.collision;

import com.gamebook.tank.*;
import com.electrotank.electroserver4.extensions.api.value.Esobject;
import com.electrotank.electroserver4.extensions.api.value.Number;
import java.awt.Point;
import org.slf4j.Logger;

public class Collision {

    private boolean collide;
    private Point collisionPoint;
    private long timeOfCollision;
    private PlayerInfo tank = null;
    private Projectile bullet;
    private boolean tankKilled = false;
    private String collisionType;
    
    public Esobject toEsobject() {
        Esobject message = new Esobject();
        message.setString(PluginConstants.ACTION PluginConstants.SHOT_HIT);
        message.setNumber(PluginConstants.TIME_STAMP new Number( timeOfCollision ));
        message.setInteger(PluginConstants.ITEM_ID bullet.getId());
        message.setString(PluginConstants.SHOT_HIT collisionType);
        if (tank != null) {
            message.setString(PluginConstants.NAME tank.getPlayerName());
            message.setInteger(PluginConstants.HEALTH tank.getHealth());
        }
        return message;
    }
    
    public static Esobject getMissMessage(Projectile bullet) {
        Esobject message = new Esobject();
        message.setString(PluginConstants.ACTION PluginConstants.SHOT_HIT);
        message.setNumber(PluginConstants.TIME_STAMP new Number( bullet.getTargetTime() ));
        message.setInteger(PluginConstants.ITEM_ID bullet.getId());
        message.setString(PluginConstants.SHOT_HIT PluginConstants.COLLISION_OUT_OF_BOUNDS);
        return message;
    }
    
    public void executeHit(Logger logger) {
        if (tank != null) {
            int health = tank.decrementHealth();
            if (health <= 0) {
                setTankKilled(true);
                logger.debug(“tank killed!“);
            }
        }
    }

    public boolean canCollide() {
        return collide;
    }

    public void setCollide(boolean collide) {
        this.collide = collide;
    }

    public Point getCollisionPoint() {
        return collisionPoint;
    }

    public void setCollisionPoint(Point collisionPoint) {
        this.collisionPoint = collisionPoint;
    }

    public long getTimeOfCollision() {
        return timeOfCollision;
    }

    public void setTimeOfCollision(long timeOfCollision) {
        this.timeOfCollision = timeOfCollision;
    }

    public PlayerInfo getTank() {
        return tank;
    }

    public void setTank(PlayerInfo tank) {
        this.tank = tank;
    }

    public Projectile getBullet() {
        return bullet;
    }

    public void setBullet(Projectile bullet) {
        this.bullet = bullet;
    }

    public boolean isTankKilled() {
        return tankKilled;
    }

    public void setTankKilled(boolean tankKilled) {
        this.tankKilled = tankKilled;
    }

    public String getCollisionType() {
        return collisionType;
    }

    public void setCollisionType(String collisionType) {
        this.collisionType 

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    .......    141774  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\CoopGame.swf

    .......      1033  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\levels\level0.xml

    .......      2299  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\levels\level1.xml

    .......      2829  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\levels\level2.xml

    .......        66  2009-06-25 08:59  chapter11\blob_bros_game\client\bin\server.xml

    .......     41307  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\areYouReady.mp3

    .......    526729  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\backGroundMusic.mp3

    .......     11143  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\death.mp3

    .......      9665  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\electricGate.mp3

    .......     48610  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\gameOver.mp3

    .......     17681  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\laserBeam.mp3

    .......     29384  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\lever.mp3

    .......     14910  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\moan.mp3

    .......     22696  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\moveRock.mp3

    .......     21249  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\savePoint.mp3

    .......     38161  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\towerDestroy.mp3

    .......     59850  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\victory.mp3

    .......     18015  2009-06-25 08:58  chapter11\blob_bros_game\client\bin\sounds\yo.mp3

    .......      2615  2009-06-25 08:58  chapter11\blob_bros_game\client\CoopGame.as3proj

    .......    152946  2009-06-25 08:58  chapter11\blob_bros_game\client\lib\as3-client-4.0.6a.swc

    .......      1097  2009-06-25 08:58  chapter11\blob_bros_game\client\obj\CoopGameConfig.old

    .......      1097  2009-06-25 08:58  chapter11\blob_bros_game\client\obj\CoopGameConfig.xml

    .......   2148864  2009-06-25 08:58  chapter11\blob_bros_game\client\src\assets\assets.fla

    .......     19059  2009-06-25 08:58  chapter11\blob_bros_game\client\src\assets\assets.swf

    .......     37211  2009-06-25 08:58  chapter11\blob_bros_game\client\src\assets\sounds\areYouReady.mp3

    .......     17681  2009-06-25 08:58  chapter11\blob_bros_game\client\src\assets\sounds\laserBeam.mp3

    .......     19025  2009-06-25 08:58  chapter11\blob_bros_game\client\src\com\gamebook\coop\CoopGame.as

    .......       981  2009-06-25 08:58  chapter11\blob_bros_game\client\src\com\gamebook\coop\elements\Gate.as

    .......       431  2009-06-25 08:58  chapter11\blob_bros_game\client\src\com\gamebook\coop\elements\GoalPad.as

    .......      1846  2009-06-25 08:58  chapter11\blob_bros_game\client\src\com\gamebook\coop\elements\LaserBeam.as

............此处省略820个文件信息

评论

共有 条评论