Esempio n. 1
0
    /**
     * Determines the physics type of the game, creating the VGDLPhysics objects that performs the calculations.
     * @param physicstype identifier of the physics type.
     * @param size dimensions of the sprite.
     * @return the vgdlphyics object.
     */
    private VGDLPhysics determinePhysics()
    {
        if (physicstype.CompareAndIgnoreCase(VGDLPhysics.GRID))
        {
            physics = new GridPhysics(size);
        }
        else if (physicstype.CompareAndIgnoreCase(VGDLPhysics.CONT))
        {
            physics = new ContinuousPhysics();
        }

        return(physics);
    }
Esempio n. 2
0
    public VGDLSprite()
    {
        physicstype       = "GRID";
        wMult             = hMult = 1.0f;
        physics           = null;
        gravity           = 0.0f;
        friction          = 0.0f;
        speed             = 0;
        stationary        = false;
        cooldown          = 0;
        color             = VGDLColors.GetRandomColor();
        only_active       = false;
        name              = null;
        is_static         = false;
        is_avatar         = false;
        is_stochastic     = false;
        is_from_avatar    = false;
        mass              = 1;
        shrinkfactor      = 1.0f;
        autotiling        = false;
        randomtiling      = -1;
        frameRate         = -1;
        frameRemaining    = 0;
        currentFrame      = -1;
        is_oriented       = false;
        draw_arrow        = false;
        orientation       = VGDLUtils.VGDLDirections.NONE.getDirection();
        lastmove          = 0;
        invisible         = "false";
        rotateInPlace     = false;
        isFirstTick       = true;
        disabled          = false;
        limitHealthPoints = 1000;

        rotation  = 0.0f;
        max_speed = -1.0f;
    }
Esempio n. 3
0
 public VGDLSprite(VGDLSprite from)
 {
     name              = from.name;
     is_static         = from.is_static;
     only_active       = from.only_active;
     is_avatar         = from.is_avatar;
     is_stochastic     = from.is_stochastic;
     color             = from.color;
     cooldown          = from.cooldown;
     speed             = from.speed;
     stationary        = from.stationary;
     mass              = from.mass;
     physicstype       = from.physicstype;
     physics           = from.physics;
     gravity           = from.gravity;
     friction          = from.friction;
     shrinkfactor      = from.shrinkfactor;
     is_oriented       = from.is_oriented;
     draw_arrow        = from.draw_arrow;
     orientation       = from.orientation;
     rect              = new Rect(from.rect);
     lastrect          = new Rect(from.lastrect);
     lastmove          = from.lastmove;
     jump_strength     = from.jump_strength;
     singleton         = from.singleton;
     is_resource       = from.is_resource;
     portal            = from.portal;
     invisible         = from.invisible;
     hidden            = from.hidden;
     autotiling        = from.autotiling;
     randomtiling      = from.randomtiling;
     frameRate         = from.frameRate;
     frameRemaining    = from.frameRemaining;
     currentFrame      = from.currentFrame;
     disabled          = from.disabled;
     image             = from.image;
     texture           = from.texture;
     img               = from.img;
     orientedImg       = from.orientedImg;
     is_npc            = from.is_npc;
     spriteID          = from.spriteID;
     is_from_avatar    = from.is_from_avatar;
     bucket            = from.bucket;
     bucketSharp       = from.bucketSharp;
     rotateInPlace     = from.rotateInPlace;
     isFirstTick       = from.isFirstTick;
     healthPoints      = from.healthPoints;
     maxHealthPoints   = from.maxHealthPoints;
     limitHealthPoints = from.limitHealthPoints;
     rotation          = from.rotation;
     size              = from.size;
     on_ground         = from.on_ground;
     solid             = from.solid;
     max_speed         = from.max_speed;
     types.AddRange(from.types);
     foreach (var pair in from.resources)
     {
         resources.Add(pair.Key, pair.Value);
     }
     foreach (var pair in from.images)
     {
         images.Add(pair.Key, pair.Value);
     }
 }