Exemple #1
0
    public void Render(NewBehaviourScript scene, int cameraX, int cameraY)
    {
        if (this.OptimizedOut) return;

        if (this.Transform == null)
        {
            this.Transform = scene.AllocateTransform();
        }

        int x = this.X * 64 - cameraX;
        int y = this.Y * 64 - cameraY;

        string imageId = "tile_wall";
        if (this.IsDoor)
        {
            imageId = "door";
        }
        else if (this.ID == 'w')
        {
            imageId = "wtile";
        }

        if (this.Optimizations == 1)
        {
            scene.DrawImage(this.Transform, imageId, x, y, 64, 64, false);
        }
        else
        {
            scene.DrawImageTiled(this.Transform, imageId, x, y, 64, 64, this.Optimizations * 64, 64);
        }
    }
Exemple #2
0
    public void Render(NewBehaviourScript scene, int cameraX, int cameraY)
    {
        if (this.isDead) return;

        ++this.renderCounter;
        this.transform = this.transform ?? scene.AllocateTransform();

        int x = (int)this.ModelX - 32 - cameraX;
        int y = (int)this.ModelY - 32 - cameraY;

        bool reverse = false;
        string imageId = null;
        switch (this.Type)
        {
            case "player":
                reverse = !this.faceRight;
                imageId = "player_" + (this.hasBeak ? "" : "no") + "beak_" + (this.moving ? ("walk_" + (((this.renderCounter / 8) % 2) + 1)) : "stand");
                break;

            case "beak":
                imageId = "beak_" + ((this.renderCounter / 6) % 4);
                break;

            case "feather":
                imageId = "feather";
                reverse = this.faceRight;
                break;

            case "alien":
                reverse = this.faceRight;
                string mouthSuffix = "_mouth" + (this.renderCounter % 3);
                if (this.moving)
                {
                    imageId = "alien_walk" + ((this.renderCounter / 4) % 2 ) + mouthSuffix;
                }
                else
                {
                    imageId = "alien_stand" + mouthSuffix;
                }
                break;

            default:
                throw new System.Exception("Unknown sprite ID");
        }

        scene.DrawImage(this.transform, imageId, x, y, 64, 64, reverse);
    }