예제 #1
0
    public LungLevel()
    {
        background_ = new FAnimatedSprite("Lungs_Background");
        int[]      breathing_frames    = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
        FAnimation breathing_animation = new FAnimation("breathing", "Lungs_Background", breathing_frames, 250, true);

        background_.addAnimation(breathing_animation);
        background_.play("breathing");

        AddChild(background_);

        dust_container_size_ = new Rect(-Futile.screen.halfWidth * 2.5f, -Futile.screen.halfHeight * 2.5f, Futile.screen.width * 2.5f, Futile.screen.height * 2.5f);

        dust1_ = new Dust("Dust_4", dust_container_size_);
        AddChild(dust1_);

        tubes1_ = new FSprite("Lungs_Rear");
        AddChild(tubes1_);
        tubes2_ = new FSprite("Lungs_MidBack1");
        AddChild(tubes2_);

        dust2_ = new Dust("Dust_3", dust_container_size_);
        AddChild(dust2_);

        tubes3_ = new FSprite("Lungs_MiddleFore");
        AddChild(tubes3_);
        tubes4_ = new FSprite("Lungs_Fore");
        AddChild(tubes4_);

        dust3_ = new Dust("Dust_2", dust_container_size_);
        AddChild(dust3_);
    }
예제 #2
0
파일: Player.cs 프로젝트: riktothepast/LD30
    public Player()
    {
        HealthPoints = 100;
        useGravity = true;
        Gravity = 19.6f;
        weatherResistance = Vector2.zero;
        bulletImpact = 5f;
        animatedSprite = new FAnimatedSprite("dude");
        animatedSprite.addAnimation(new FAnimation("walking", new int[]{
                0,1,2,3}, 200, true));

        Size = new Vector2(animatedSprite.width*0.5f, animatedSprite.height*0.9f);
        animatedSprite.x += 2f;
        boundingBox = new Rectangle();
        impactBoundingBox = new Rectangle();
        Position = new Vector2(Futile.screen.halfWidth, -Futile.screen.halfHeight);
        AddChild(animatedSprite);

        FloorFriction = 0.58f;
        AirFriction = 0.58f;
        ammoLeft.Preallocate(5);
        detectionAccuracy = (int)(Size.x / 2) + 1;
        firingCadence = 800;
        firingCadenceTime = 800;
    }
예제 #3
0
    public LungLevel()
    {
        background_ = new FAnimatedSprite("Lungs_Background");
        int[] breathing_frames = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
        FAnimation breathing_animation = new FAnimation("breathing", "Lungs_Background", breathing_frames, 250, true);
        background_.addAnimation(breathing_animation);
        background_.play("breathing");

        AddChild(background_);

        dust_container_size_ = new Rect(-Futile.screen.halfWidth*2.5f, -Futile.screen.halfHeight*2.5f, Futile.screen.width*2.5f, Futile.screen.height*2.5f);

        dust1_ = new Dust("Dust_4", dust_container_size_);
        AddChild(dust1_);

        tubes1_ = new FSprite("Lungs_Rear");
        AddChild(tubes1_);
        tubes2_ = new FSprite("Lungs_MidBack1");
        AddChild(tubes2_);

        dust2_ = new Dust("Dust_3", dust_container_size_);
        AddChild(dust2_);

        tubes3_ = new FSprite("Lungs_MiddleFore");
        AddChild(tubes3_);
        tubes4_ = new FSprite("Lungs_Fore");
        AddChild(tubes4_);

        dust3_ = new Dust("Dust_2", dust_container_size_);
        AddChild(dust3_);
    }
예제 #4
0
파일: Ninja.cs 프로젝트: maggardJosh/OGREAT
    public Ninja(World world)
        : base(new RXRect(-1, -3, 6, 5), world, "enemy1shadow")
    {
        hitBox.x = -1;
        hitBox.y = -3;
        hitBox.width = 6;
        hitBox.height = 5;

        UpdateHitBoxSprite();
        stateCount = RXRandom.Float() * minStateCount;
        handleStateCount = true;
        useActualMaxVel = true;
        maxVel = 1;
        health = 2;
        sprite = new FAnimatedSprite("ninja");
        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.IDLE, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.IDLE, new int[] { 5 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.IDLE, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.IDLE, new int[] { 1 }, 150, false));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.BOUNCE, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.BOUNCE, new int[] { 5 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.BOUNCE, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.BOUNCE, new int[] { 1 }, 150, false));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.LAND, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.LAND, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.LAND, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.LAND, new int[] { 1 }, 150, false));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.MOVING, new int[] { 1, 2, 1, 3 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.MOVING, new int[] { 5, 6, 5, 7 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.MOVING, new int[] { 1, 2, 1, 3 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.MOVING, new int[] { 1, 2, 1, 3 }, 150, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.SPAWNING, new int[] { 1, 2, 1, 3 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.SPAWNING, new int[] { 5, 6, 5, 7 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.SPAWNING, new int[] { 1, 2, 1, 3 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.SPAWNING, new int[] { 1, 2, 1, 3 }, 150, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.START_ATTACK, new int[] { 17 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.START_ATTACK, new int[] { 17 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.START_ATTACK, new int[] { 17 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.START_ATTACK, new int[] { 17 }, 150, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.ATTACKING, new int[] { 9, 10, 11, 12, 13, 14, 15, 16 }, 20, true));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.ATTACKING, new int[] { 9, 10, 11, 12, 13, 14, 15, 16 }, 20, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.ATTACKING, new int[] { 9, 10, 11, 12, 13, 14, 15, 16 }, 20, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.ATTACKING, new int[] { 9, 10, 11, 12, 13, 14, 15, 16 }, 20, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.TAKE_DAMAGE, new int[] { 4 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.TAKE_DAMAGE, new int[] { 8 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.TAKE_DAMAGE, new int[] { 4 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.TAKE_DAMAGE, new int[] { 4 }, 150, false));
        this.AddChild(sprite);
    }
예제 #5
0
파일: Portal.cs 프로젝트: riktothepast/LD30
 public Portal(Vector2 pos, int dest)
 {
     position = pos;
     destination = dest;
     animatedSprite = new FAnimatedSprite("portal");
     animatedSprite.addAnimation(new FAnimation("glow", new int[]{
             0,1,2,3}, 200, true));
     AddChild(animatedSprite);
     boundingBox = new Rectangle();
 }
예제 #6
0
 public AttackWide(World world, Direction d)
     : base(new RXRect(0, 0, 48, 16), world)
 {
     this._direction = d;
     this.blocksOtherObjects = false;
     sprite = new FAnimatedSprite("attackWide");
     sprite.addAnimation(new FAnimation(Direction.DOWN.ToString(), new int[] { 1, 2, 3, 4, 5, 6 }, 50, false));
     this.AddChild(sprite);
     PlayAnim();
 }
예제 #7
0
    public Drawable(string sprite)
    {
        //Initialize
        m_Width		= 0;
        m_Height	= 0;
        m_Sprite	= null;
        m_Animated	= null;

        //if name exist
        if (sprite != null) createSprite(new FSprite(sprite));
    }
예제 #8
0
    public Player()
    {
        ListenForUpdate(Update);

        sprite = new FAnimatedSprite(new FAnimation("idle","DEMOPlayer",16,16,0,0,1,70,false));
        this.AddChild(sprite);

        sprite.addAnimation(new FAnimation("walking","DEMOPlayer",16,16,1,0,4,70,true));
        sprite.addAnimation(new FAnimation("jumping","DEMOPlayer",16,16,2,0,1,70,false));

        ChangeState(CharacterState.idle);
    }
    // Use this for initialization
    void Start()
    {
        FutileParams fparams = new FutileParams(true, true, false, false);

        fparams.AddResolutionLevel(480.0f, 2.0f, 1.0f, "");
        fparams.origin          = new Vector2(0.5f, 0.5f);
        fparams.backgroundColor = new Color(0.15f, 0.15f, 0.3f);
        Futile.instance.Init(fparams);

        // load image atlas (within Resources/Atlases folder)
        Futile.atlasManager.LoadAtlas("Atlases/Burglar");

        // Add tilemap
        FTilemap room1 = new FTilemap("Burglar Walls");

        room1.LoadCSV("CSVs/Room1Map");         // load comma separated text file (within Resources/CSVs folder)
        room1.x  = -room1.width / 2;
        room1.y -= 4;
        Futile.stage.AddChild(room1);

        // create burglar
        burglar   = new FAnimatedSprite("Burglar");
        burglar.y = -24;
        int[] frames = { 1, 1, 2, 1, 1, 1, 10, 1, 11, 1 }; // idle anim
        burglar.addAnimation(new FAnimation("idle", frames, 400, true));
        int[] frames2 = { 3, 4, 5, 6, 4, 7 };              // run anim
        burglar.addAnimation(new FAnimation("run", frames2, 180, true));
        Futile.stage.AddChild(burglar);                    // add burglar to stage

        // load font atlas
        Futile.atlasManager.LoadAtlas("Atlases/Fonts");

        // Add large font text
        Futile.atlasManager.LoadFont("Large", "Large Font", "Atlases/Large Font", 0, 0);
        FLabel label1 = new FLabel("Large", "LARGE FONT");

        label1.y = 26;
        Futile.stage.AddChild(label1);

        // Add small font text
        Futile.atlasManager.LoadFont("Small", "Small Font", "Atlases/Small Font", 0, 0);
        FLabel label2 = new FLabel("Small", "Small Font");

        label2.y = 12;
        Futile.stage.AddChild(label2);

        // Add tiny font text
        Futile.atlasManager.LoadFont("Tiny", "Tiny Font", "Atlases/Tiny Font", 0, 0);
        FLabel label3 = new FLabel("Tiny", "Tiny Font");

        label3.y = 3;
        Futile.stage.AddChild(label3);
    }
예제 #10
0
    protected void createAnimatedSprite(FAnimatedSprite sprite)
    {
        //Skip if no sprite
        if (sprite == null) return;

        //Save sprite
        m_Animated = sprite;
        AddChild(m_Animated);

        //Set size
        m_Width 	= m_Animated.textureRect.width;
        m_Height 	= m_Animated.textureRect.height;
    }
예제 #11
0
 public EnemyPortal(Vector2 pos)
 {
     Position = pos;
     animatedSprite = new FAnimatedSprite("portal");
     animatedSprite.addAnimation(new FAnimation("glow", new int[]{
             0,1,2,3}, 200, true));
     AddChild(animatedSprite);
     animatedSprite.color = Color.red;
     boundingBox = new Rectangle();
     useGravity = false;
     ListenForUpdate(Update);
     HealthPoints = 10;
     Size = new Vector2(animatedSprite.width, animatedSprite.height);
     boundingBox = new Rectangle();
 }
    // Use this for initialization
    void Start()
    {
        FutileParams fparams = new FutileParams(true, true, false, false);
        fparams.AddResolutionLevel(480.0f, 2.0f, 1.0f, "");
        fparams.origin = new Vector2(0.5f, 0.5f);
        fparams.backgroundColor = new Color(0.15f, 0.15f, 0.3f);
        Futile.instance.Init(fparams);

        // load image atlas (within Resources/Atlases folder)
        Futile.atlasManager.LoadAtlas("Atlases/Burglar");

        // Add tilemap
        FTilemap room1 = new FTilemap("Burglar Walls");
        room1.LoadCSV("CSVs/Room1Map"); // load comma separated text file (within Resources/CSVs folder)
        room1.x = -room1.width/2;
        room1.y -= 4;
        Futile.stage.AddChild(room1);

        // create burglar
        burglar = new FAnimatedSprite("Burglar");
        burglar.y = -24;
        int[] frames = { 1,1,2,1,1,1,10,1,11,1 }; // idle anim
        burglar.addAnimation(new FAnimation("idle", frames, 400, true));
        int[] frames2 = { 3,4,5,6,4,7 }; // run anim
        burglar.addAnimation(new FAnimation("run", frames2, 180, true));
        Futile.stage.AddChild(burglar); // add burglar to stage

        // load font atlas
        Futile.atlasManager.LoadAtlas("Atlases/Fonts");

        // Add large font text
        Futile.atlasManager.LoadFont("Large", "Large Font", "Atlases/Large Font");
        FLabel label1 = new FLabel("Large", "LARGE FONT");
        label1.y = 26;
        Futile.stage.AddChild(label1);

        // Add small font text
        Futile.atlasManager.LoadFont("Small", "Small Font", "Atlases/Small Font");
        FLabel label2 = new FLabel("Small", "Small Font");
        label2.y = 12;
        Futile.stage.AddChild(label2);

        // Add tiny font text
        Futile.atlasManager.LoadFont("Tiny", "Tiny Font", "Atlases/Tiny Font");
        FLabel label3 = new FLabel("Tiny", "Tiny Font");
        label3.y = 3;
        Futile.stage.AddChild(label3);
    }
예제 #13
0
    public Knight(World world, string name)
        : base(new RXRect(0, -6, 10, 8), world)
    {
        this.name = name;

        maxXVel = .5f;
        maxYVel = .5f;
        minYVel = -.5f;
        handleStateCount = true;
        handleDamageObjectCollision = true;
        bounceiness = 0f;
        clearAcc = false;

        sprite = new FAnimatedSprite("knight");
        sprite.addAnimation(new FAnimation(KnightState.MOVING.ToString() + Direction.DOWN, new int[] { 1, 2, 3, 4 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.MOVING.ToString() + Direction.UP, new int[] { 5, 6, 7, 8 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.MOVING.ToString() + Direction.LEFT, new int[] { 9, 10, 11, 12 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.MOVING.ToString() + Direction.RIGHT, new int[] { 9, 10, 11, 12 }, 150, true));

        sprite.addAnimation(new FAnimation(KnightState.IDLE.ToString() + Direction.DOWN, new int[] { 1 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.IDLE.ToString() + Direction.UP, new int[] { 5 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.IDLE.ToString() + Direction.LEFT, new int[] { 9 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.IDLE.ToString() + Direction.RIGHT, new int[] { 9 }, 150, true));

        sprite.addAnimation(new FAnimation(KnightState.DYING.ToString() + Direction.DOWN, new int[] { 1 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.DYING.ToString() + Direction.UP, new int[] { 5 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.DYING.ToString() + Direction.LEFT, new int[] { 9 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.DYING.ToString() + Direction.RIGHT, new int[] { 9 }, 150, true));

        sprite.addAnimation(new FAnimation(KnightState.INVULNERABLE.ToString() + Direction.DOWN, new int[] { 1 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.INVULNERABLE.ToString() + Direction.UP, new int[] { 5 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.INVULNERABLE.ToString() + Direction.LEFT, new int[] { 9 }, 150, true));
        sprite.addAnimation(new FAnimation(KnightState.INVULNERABLE.ToString() + Direction.RIGHT, new int[] { 9 }, 150, true));

        sprite.addAnimation(new FAnimation(KnightState.ATTACK_START.ToString() + Direction.DOWN, new int[] { 13 }, 350, false));
        sprite.addAnimation(new FAnimation(KnightState.ATTACK_START.ToString() + Direction.UP, new int[] { 15 }, 350, false));
        sprite.addAnimation(new FAnimation(KnightState.ATTACK_START.ToString() + Direction.LEFT, new int[] { 17 }, 350, false));
        sprite.addAnimation(new FAnimation(KnightState.ATTACK_START.ToString() + Direction.RIGHT, new int[] { 17 }, 350, false));

        sprite.addAnimation(new FAnimation(KnightState.ATTACKING.ToString() + Direction.DOWN, new int[] { 13, 14 }, 350, false));
        sprite.addAnimation(new FAnimation(KnightState.ATTACKING.ToString() + Direction.UP, new int[] { 15, 16 }, 350, false));
        sprite.addAnimation(new FAnimation(KnightState.ATTACKING.ToString() + Direction.LEFT, new int[] { 17, 18 }, 350, false));
        sprite.addAnimation(new FAnimation(KnightState.ATTACKING.ToString() + Direction.RIGHT, new int[] { 17, 18 }, 350, false));

        PlayAnim();
        this.AddChild(sprite);
    }
예제 #14
0
 public BaseGameObject(string elementBase)
     : base(elementBase + "_1")
 {
     this.elementBase = elementBase;
     for (int x = 1; x < 4; x++)
     {
         if (Futile.atlasManager.elementExists(elementBase + "_" + (x + 1) + "/0"))
         {
             otherAnims[x - 1] = new FAnimatedSprite(elementBase + "_" + (x + 1));
             maxLevel          = x + 1;
         }
         else
         {
             otherAnims[x - 1] = new FAnimatedSprite(elementBase + "_1");
         }
     }
 }
예제 #15
0
 public MagicOrb(FNode owner, World world)
     : base(new RXRect(0, 0, 5, 5), world)
 {
     this.useActualMaxVel = true;
     maxVel = 2;
     this.bounceiness = 1f;
     this.owner = owner;
     handleStateCount = true;
     collidesWithWater = false;
     sprite = new FAnimatedSprite("Magic Orb/magic_orb");
     sprite.addAnimation(new FAnimation("idle", new int[] { 1, 2 }, 150, true));
     sprite.play("idle");
     this.AddChild(sprite);
     this.xVel = RXRandom.Float() * .5f - .25f;
     this.yVel = RXRandom.Float() * .5f - .25f;
     FSoundManager.PlaySound("orbShoot");
 }
예제 #16
0
	// Use this for initialization
	void Start () {

        FutileParams futileParams = new FutileParams(true, false, false, false);
        futileParams.AddResolutionLevel(568.0f, 1.0f, 1.0f, ""); // Scale up to 1136

        futileParams.origin = new Vector2(0.5f, 0.5f);
        futileParams.backgroundColor = new Color(0, 0, 0);
        futileParams.shouldLerpToNearestResolutionLevel = true;

        Futile.instance.Init(futileParams);

        Futile.atlasManager.LoadAtlas("Atlases/NinjaCircuitAtlas");

        FAnimatedSprite test = new FAnimatedSprite("player");
        test.addAnimation(new FAnimation("run", new int[] { 1,2 },100,true));
        test.play("run");
        Futile.stage.AddChild(test);

	}
예제 #17
0
    public ArrowTurret(float interval, float initDelay, World world)
        : base(new RXRect(0,-4,12,8), world)
    {
        this.interval = interval;
        handleStateCount = true;
        this.initDelay = initDelay;
        sprite = new FAnimatedSprite("Arrow Turret/turret_arrow");
        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + true.ToString(), new int[] { 1}, 150, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + true.ToString(), new int[] { 3 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + true.ToString(), new int[] { 5 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + true.ToString(), new int[] { 5 }, 150, false));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + false.ToString(), new int[] { 2 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + false.ToString(), new int[] { 4 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + false.ToString(), new int[] { 6 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + false.ToString(), new int[] { 6 }, 150, false));

        this.AddChild(sprite);
        PlayAnim();
    }
예제 #18
0
    public Door(string name, World world, float x, float y)
        : base(new RXRect(0,0,16,16),world)
    {
        this.name = name;
        this.SetPosition(x, y);
        this.blocksJump = true;
        sprite = new FAnimatedSprite("Door/door");
        sprite.addAnimation(new FAnimation(State.CLOSED.ToString(), new int[] { 1 }, 150, false));
        sprite.ignoreTransitioning = true;
        sprite.addAnimation(new FAnimation(State.OPENING.ToString(), new int[] { 2,3,4,5,6,7 }, 150, false));
        sprite.addAnimation(new FAnimation(State.OPENED.ToString(), new int[] {  7 }, 150, false));

        if (C.Save.switchesActivated.Contains(name))
        {
            this.blocksOtherObjects = false;
            currentState = State.OPENED;
        }
        this.AddChild(sprite);
        PlayAnim();
    }
예제 #19
0
    protected virtual void Update()
    {
        pushAwayFromWalls();

        this.sortZ = -y;
        for (int x = 0; x < 3; x++)
        {
            FAnimatedSprite sprite = otherAnims[x];
            sprite.SetPosition(this.GetPosition());
            sprite.sortZ = this.sortZ;
            if (maxLevel >= x + 2)
            {
                sprite.SetElementByName(this.elementBase + "_" + (x + 2) + "/" + this.currentFrame);
            }
            sprite.alpha    = this.alpha;
            sprite.rotation = this.rotation;
        }

        showCurrentLevel();
    }
예제 #20
0
    public HitSwitch(string doorName, string name, World world)
        : base(new RXRect(0, 0, 10,10), world)
    {
        this.handleStateCount = true;
        this.blocksOtherObjects = true;
        this.doorName = doorName;
        this.name = name;
        sprite = new FAnimatedSprite("HitSwitch/switch");
        sprite.addAnimation(new FAnimation("idle", new int[] { 1 }, 100, false));
        sprite.addAnimation(new FAnimation("activate", new int[] { 1,1,1,1,2, 3 }, 150, false));
        sprite.addAnimation(new FAnimation("activated", new int[] {3 }, 150, false));
        sprite.play("idle");
        sprite.ignoreTransitioning = true;
        this.AddChild(sprite);

        if (C.Save.switchesActivated.Contains(this.name))
        {
            pressed = true;
            sprite.play("activated");
        }
    }
예제 #21
0
    public Player(World world)
        : base(new RXRect(0, -5, 12, 7), world, "playerShadow")
    {
        int animSpeed = 200;
        int attackSpeed = 100;
        sprite = new FAnimatedSprite("player");
        bounceiness = 0;
        ResetMaxVel();
        handleStateCount = true;
        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.IDLE + "1", new int[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 9, 1 }, animSpeed, false));
        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.IDLE + "2", new int[] { 10, 1 }, 1500, false));
        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.IDLE + "3", new int[] { 1, 10, 11, 10, 1 }, animSpeed, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.IDLE, new int[] { 4 }, animSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.IDLE, new int[] { 7 }, animSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.IDLE, new int[] { 7 }, animSpeed, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.MOVING, new int[] { 1, 2, 1, 3 }, animSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.MOVING, new int[] { 4, 5, 4, 6 }, animSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.MOVING, new int[] { 7, 8 }, animSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.MOVING, new int[] { 7, 8 }, animSpeed, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.ATTACKING, new int[] { 17, 18 }, attackSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.ATTACKING, new int[] { 19, 20 }, attackSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.ATTACKING, new int[] { 21, 22 }, attackSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.ATTACKING, new int[] { 21, 22 }, attackSpeed, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.TAKE_DAMAGE, new int[] { 12 }, animSpeed, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.TAKE_DAMAGE, new int[] { 13 }, animSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.TAKE_DAMAGE, new int[] { 14 }, animSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.TAKE_DAMAGE, new int[] { 14 }, animSpeed, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.DYING, new int[] { 25 }, animSpeed, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.DYING, new int[] { 25 }, animSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.DYING, new int[] { 25 }, animSpeed, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.DYING, new int[] { 25 }, animSpeed, true));

        sprite.play(Direction.UP.ToString());
        this.AddChild(sprite);
    }
예제 #22
0
    public Villager(List<string> dialogue, World world, string villagerType = "A")
        : base(new RXRect(0, -6, 10, 8), world)
    {
        this.dialogue = dialogue;
        maxXVel = .5f;
        maxYVel = .5f;
        minYVel = -.5f;
        handleStateCount = true;
        bounceiness = 0f;
        clearAcc = false;

        sprite = new FAnimatedSprite("villager" + villagerType);
        if (villagerType == "A")
        {

            sprite.addAnimation(new FAnimation(VillagerState.MOVING.ToString() + Direction.DOWN, new int[] { 1, 2, 3, 4 }, 150, true));
            sprite.addAnimation(new FAnimation(VillagerState.MOVING.ToString() + Direction.UP, new int[] { 5, 6, 7, 8 }, 150, true));
            sprite.addAnimation(new FAnimation(VillagerState.MOVING.ToString() + Direction.LEFT, new int[] { 9, 10, 11, 12 }, 150, true));
            sprite.addAnimation(new FAnimation(VillagerState.MOVING.ToString() + Direction.RIGHT, new int[] { 9, 10, 11, 12 }, 150, true));

            sprite.addAnimation(new FAnimation(VillagerState.IDLE.ToString() + Direction.DOWN, new int[] { 1 }, 150, true));
            sprite.addAnimation(new FAnimation(VillagerState.IDLE.ToString() + Direction.UP, new int[] { 5 }, 150, true));
            sprite.addAnimation(new FAnimation(VillagerState.IDLE.ToString() + Direction.LEFT, new int[] { 9 }, 150, true));
            sprite.addAnimation(new FAnimation(VillagerState.IDLE.ToString() + Direction.RIGHT, new int[] { 9 }, 150, true));
        }
        else
        {
            walks = false;
            sprite.addAnimation(new FAnimation(VillagerState.MOVING.ToString() + Direction.DOWN, new int[] { 1 }, 150, true));
            sprite.addAnimation(new FAnimation(VillagerState.IDLE.ToString() + Direction.DOWN, new int[] { 1 }, 150, true));
        }

        PlayAnim();
        this.AddChild(sprite);
        indicator = new InteractInd(0, 5);
        this.AddChild(indicator);
    }
예제 #23
0
    public Ghost(World world, string name)
        : base(new RXRect(1, -2, 10, 10), world)
    {
        this.name = name;
        handleStateCount = true;
        collidesWithWater = false;
        collidesWithWalls = false;
        clearAcc = false;
        useActualMaxVel = true;
        maxVel = .5f;
        sprite = new FAnimatedSprite("ghost");
        sprite.addAnimation(new FAnimation(GhostState.IDLE.ToString() + Direction.DOWN, new int[] { 1 }, 150, true));
        sprite.addAnimation(new FAnimation(GhostState.IDLE.ToString() + Direction.UP, new int[] { 5 }, 150, true));
        sprite.addAnimation(new FAnimation(GhostState.IDLE.ToString() + Direction.LEFT, new int[] { 9}, 150, true));
        sprite.addAnimation(new FAnimation(GhostState.IDLE.ToString() + Direction.RIGHT, new int[] { 9 }, 150, true));

        sprite.addAnimation(new FAnimation(GhostState.MOVING.ToString() + Direction.DOWN, new int[] { 1, 2, 3, 4 }, 150, true));
        sprite.addAnimation(new FAnimation(GhostState.MOVING.ToString() + Direction.UP, new int[] { 5, 6, 7, 8 }, 150, true));
        sprite.addAnimation(new FAnimation(GhostState.MOVING.ToString() + Direction.LEFT, new int[] { 9,10,11,12 }, 150, true));
        sprite.addAnimation(new FAnimation(GhostState.MOVING.ToString() + Direction.RIGHT, new int[] { 9,10,11,12}, 150, true));

        this.AddChild(sprite);
        PlayAnim();
    }
예제 #24
0
파일: Enemy.cs 프로젝트: maggardJosh/OGREAT
    public Enemy(World world, int type)
        : base(new RXRect(-1, -3, 6, 5), world, "enemy" + type.ToString() + "shadow")
    {
        currentState = State.SPAWN;
        switch (type)
        {
            case 1:
                hitBox.x = -1;
                hitBox.y = -3;
                hitBox.width = 6;
                hitBox.height = 5;
                break;
            case 2:
                hitBox.x = -1;
                hitBox.y = -5;
                hitBox.width = 9;
                hitBox.height = 6;
                break;
        }
        UpdateHitBoxSprite();
        stateCount = RXRandom.Float() * minStateCount;
        handleStateCount = true;
        useActualMaxVel = true;
        maxVel = 1;
        switch (type)
        {
            case 1:
                health = 1;
                break;
            case 2:
                health = 3;
                break;
        }
        sprite = new FAnimatedSprite("enemy" + type.ToString());
        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.IDLE, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.IDLE, new int[] { 5 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.IDLE, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.IDLE, new int[] { 1 }, 150, false));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.BOUNCE, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.BOUNCE, new int[] { 5 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.BOUNCE, new int[] { 1 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.BOUNCE, new int[] { 1 }, 150, false));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.MOVING, new int[] { 1, 2, 1, 3 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.MOVING, new int[] { 5, 6, 5, 7 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.MOVING, new int[] { 1, 2, 1, 3 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.MOVING, new int[] { 1, 2, 1, 3 }, 150, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.SPAWN, new int[] { 1, 2, 1, 3 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.SPAWN, new int[] { 5, 6, 5, 7 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.SPAWN, new int[] { 1, 2, 1, 3 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.SPAWN, new int[] { 1, 2, 1, 3 }, 150, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.START_ATTACK, new int[] { 9 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.START_ATTACK, new int[] { 9 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.START_ATTACK, new int[] { 9 }, 150, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.START_ATTACK, new int[] { 9 }, 150, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.ATTACKING, new int[] { 9, 10, 9, 11 }, 100, true));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.ATTACKING, new int[] { 5, 6, 5, 7 }, 100, true));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.ATTACKING, new int[] { 9, 10, 9, 11 }, 100, true));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.ATTACKING, new int[] { 9, 10, 9, 11 }, 100, true));

        sprite.addAnimation(new FAnimation(Direction.DOWN.ToString() + State.TAKE_DAMAGE, new int[] { 4 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.UP.ToString() + State.TAKE_DAMAGE, new int[] { 8 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.RIGHT.ToString() + State.TAKE_DAMAGE, new int[] { 4 }, 150, false));
        sprite.addAnimation(new FAnimation(Direction.LEFT.ToString() + State.TAKE_DAMAGE, new int[] { 4 }, 150, false));
        this.AddChild(sprite);
    }
예제 #25
0
    public Player(World world)
        : base(new RXRect(0, -8, 8, 6), world)
    {
        swordCollision = new FutilePlatformerBaseObject(new RXRect(6, -8, 15, 10), world);

        maxXVel = 1;
        maxYVel = 1;
        minYVel = -1;
        handleStateCount = true;
        bounceiness = 0f;
        player = new FAnimatedSprite("player");

        player.addAnimation(new FAnimation(PlayerState.IDLE.ToString() + Direction.RIGHT.ToString(), new int[] { 9 }, 100, true));
        player.addAnimation(new FAnimation(PlayerState.IDLE.ToString() + Direction.LEFT.ToString(), new int[] { 9 }, 100, true));
        player.addAnimation(new FAnimation(PlayerState.IDLE.ToString() + Direction.UP.ToString(), new int[] { 5 }, 100, true));
        player.addAnimation(new FAnimation(PlayerState.IDLE.ToString() + Direction.DOWN.ToString(), new int[] { 1 }, 100, true));

        player.addAnimation(new FAnimation(PlayerState.INVULNERABLE.ToString() + Direction.RIGHT.ToString(), new int[] { 9 }, 100, true));
        player.addAnimation(new FAnimation(PlayerState.INVULNERABLE.ToString() + Direction.LEFT.ToString(), new int[] { 9 }, 100, true));
        player.addAnimation(new FAnimation(PlayerState.INVULNERABLE.ToString() + Direction.UP.ToString(), new int[] { 5 }, 100, true));
        player.addAnimation(new FAnimation(PlayerState.INVULNERABLE.ToString() + Direction.DOWN.ToString(), new int[] { 1 }, 100, true));

        player.addAnimation(new FAnimation(PlayerState.DYING.ToString() + Direction.RIGHT.ToString(), new int[] { 9 }, 100, true));
        player.addAnimation(new FAnimation(PlayerState.DYING.ToString() + Direction.LEFT.ToString(), new int[] { 9 }, 100, true));
        player.addAnimation(new FAnimation(PlayerState.DYING.ToString() + Direction.UP.ToString(), new int[] { 5 }, 100, true));
        player.addAnimation(new FAnimation(PlayerState.DYING.ToString() + Direction.DOWN.ToString(), new int[] { 1 }, 100, true));

        player.addAnimation(new FAnimation(PlayerState.MOVE.ToString() + Direction.RIGHT.ToString(), new int[] { 9, 10, 9, 12 }, 150, true));
        player.addAnimation(new FAnimation(PlayerState.MOVE.ToString() + Direction.LEFT.ToString(), new int[] { 9, 10, 9, 12 }, 150, true));
        player.addAnimation(new FAnimation(PlayerState.MOVE.ToString() + Direction.UP.ToString(), new int[] { 5, 6, 5, 8 }, 150, true));
        player.addAnimation(new FAnimation(PlayerState.MOVE.ToString() + Direction.DOWN.ToString(), new int[] { 1, 2, 1, 4 }, 150, true));

        player.addAnimation(new FAnimation(PlayerState.JUMP.ToString() + Direction.RIGHT.ToString(), new int[] { 18, 19 }, 150, false));
        player.addAnimation(new FAnimation(PlayerState.JUMP.ToString() + Direction.LEFT.ToString(), new int[] { 18, 19 }, 150, false));
        player.addAnimation(new FAnimation(PlayerState.JUMP.ToString() + Direction.UP.ToString(), new int[] { 16, 17 }, 150, false));
        player.addAnimation(new FAnimation(PlayerState.JUMP.ToString() + Direction.DOWN.ToString(), new int[] { 14, 15 }, 150, false));

        int attackSpeed = 250;
        player.addAnimation(new FAnimation(PlayerState.SWORD.ToString() + Direction.RIGHT.ToString(), new int[] { 28, 29 }, attackSpeed, false));
        player.addAnimation(new FAnimation(PlayerState.SWORD.ToString() + Direction.LEFT.ToString(), new int[] { 28, 29 }, attackSpeed, false));
        player.addAnimation(new FAnimation(PlayerState.SWORD.ToString() + Direction.UP.ToString(), new int[] { 24, 25 }, attackSpeed, false));
        player.addAnimation(new FAnimation(PlayerState.SWORD.ToString() + Direction.DOWN.ToString(), new int[] { 20, 21 }, attackSpeed, false));

        player.addAnimation(new FAnimation(PlayerState.SWORD_TWO.ToString() + Direction.RIGHT.ToString(), new int[] { 30, 31 }, attackSpeed, false));
        player.addAnimation(new FAnimation(PlayerState.SWORD_TWO.ToString() + Direction.LEFT.ToString(), new int[] { 30, 31 }, attackSpeed, false));
        player.addAnimation(new FAnimation(PlayerState.SWORD_TWO.ToString() + Direction.UP.ToString(), new int[] { 26, 27 }, attackSpeed, false));
        player.addAnimation(new FAnimation(PlayerState.SWORD_TWO.ToString() + Direction.DOWN.ToString(), new int[] { 22, 23 }, attackSpeed, false));

        player.addAnimation(new FAnimation(PlayerState.BOW_DRAWN.ToString() + Direction.DOWN.ToString(), new int[] { 32, 33 }, 150, true));
        player.addAnimation(new FAnimation(PlayerState.BOW_DRAWN.ToString() + Direction.UP.ToString(), new int[] { 35, 36 }, 150, true));
        player.addAnimation(new FAnimation(PlayerState.BOW_DRAWN.ToString() + Direction.RIGHT.ToString(), new int[] { 38, 39 }, 150, true));
        player.addAnimation(new FAnimation(PlayerState.BOW_DRAWN.ToString() + Direction.LEFT.ToString(), new int[] { 38, 39 }, 150, true));

        player.addAnimation(new FAnimation(PlayerState.BOW_SHOOTING.ToString() + Direction.DOWN.ToString(), new int[] { 34 }, 150, false));
        player.addAnimation(new FAnimation(PlayerState.BOW_SHOOTING.ToString() + Direction.UP.ToString(), new int[] { 37 }, 150, false));
        player.addAnimation(new FAnimation(PlayerState.BOW_SHOOTING.ToString() + Direction.RIGHT.ToString(), new int[] { 40 }, 150, false));
        player.addAnimation(new FAnimation(PlayerState.BOW_SHOOTING.ToString() + Direction.LEFT.ToString(), new int[] { 40 }, 150, false));

        PlayAnim(true);
        this.AddChild(player);
    }