about summary refs log tree commit diff stats
path: root/data/maps/the_extravagant/doors.txtpb
blob: b7e7e06865b836618a7559b6d7d16ea1d2bf7a06 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
doors {
  name: "M Side Middle Door"
  type: EVENT
  panels { room: "X Plus" name: "ROSE" }
}
doors {
  name: "M Side Right Door"
  type: EVENT
  panels { room: "X Plus" name: "ROSE" }
}
doors {
  name: "W Side Middle Door"
  type: EVENT
  panels { room: "X Minus" name: "DUO" }
}
doors {
  name: "W Side Right Door"
  type: EVENT
  panels { room: "X Minus" name: "DUO" }
}
doors {
  name: "E Door"
  type: EVENT
  panels { room: "Engine Room" name: "ENGINE" }
  panels { room: "Engine Room" name: "CABOOSE" }
  panels { room: "Hat Chamber" name: "BRIM" }
  panels { room: "Hat Chamber" name: "OUTFIT" }
  panels { room: "X Minus Middle Leg" name: "ANTENNA" }
  panels { room: "X Minus Right Leg" name: "ROWBOAT" }
  panels { room: "X Minus" name: "DUO" }
  panels { room: "X Plus Middle Leg" name: "COLONY" }
  panels { room: "X Plus Right Leg" name: "HEAD" }
  panels { room: "X Plus" name: "ROSE" }
  panels { room: "Y Minus First Floor" name: "RHINO" }
  panels { room: "Y Minus First Floor" name: "HORN" }
  panels { room: "Y Minus Second Floor" name: "COMPASS" }
  panels { room: "Y Minus Third Floor" name: "WHISKERS" }
  panels { room: "Y Plus Third Floor" name: "CACTUS" }
  panels { room: "Y Plus Third Floor" name: "TAIL" }
}
: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.fourisland.fourpuzzle.gamestate.mapview.event;

import com.fourisland.fourpuzzle.Direction;
import com.fourisland.fourpuzzle.gamestate.mapview.Map;
import com.fourisland.fourpuzzle.util.Functions;
import java.awt.Point;

/**
 *
 * @author hatkirby
 */
public abstract class AbstractEvent implements Event {
    
    private Point location = new Point();
    public Point getLocation()
    {
        return location;
    }
    public void setLocation(Point location)
    {
        this.location = location;
    }
    public void setLocation(int x, int y)
    {
        location.setLocation(x, y);
    }
    
    private boolean moving = false;
    public boolean isMoving()
    {
        return moving;
    }
    public void setMoving(boolean moving)
    {
        this.moving = moving;
    }
    
    /* TODO Remove the moveDirection field. As direction itself is
     * always the same as moveDirection when moveDirection is needed,
     * it will do fine without having to complicated access modifiers
     */
    
    protected int moveTimer;
    protected Direction moveDirection;
    public void startMoving(Direction toMove)
    {
        setDirection(toMove);
        
        if (!getParentMap().checkForCollision(this, toMove))
        {
            setAnimationStep(2);
            moveTimer = 4;
            setMoving(true);
            moveDirection = toMove;
        }
    }
    
    public void processMoving()
    {
        if (isMoving())
        {
            moveTimer--;
            if (moveTimer == 2)
            {
                setAnimationStep(0);
            } else if (moveTimer == 0)
            {
                setAnimationStep(1);
                moving = false;
                
                if (moveDirection == Direction.North)
                {
                    setLocation(getLocation().x,getLocation().y-1);
                } else if (moveDirection == Direction.West)
                {
                    setLocation(getLocation().x-1,getLocation().y);
                } else if (moveDirection == Direction.South)
                {
                    setLocation(getLocation().x,getLocation().y+1);
                } else if (moveDirection == Direction.East)
                {
                    setLocation(getLocation().x+1,getLocation().y);
                }
            }
        }
    }
    
    public boolean isOccupyingSpace(int x, int y)
    {
        if (getLocation().equals(new Point(x,y)))
        {
            return true;
        }
        
        if (Functions.isMovingTo(this, x, y))
        {
            return true;
        }
        
        return false;
    }
    
    private Map parentMap = null;
    public Map getParentMap()
    {
        if (parentMap == null)
        {
            throw new NullPointerException();
        }
        
        return parentMap;
    }
    public void setParentMap(Map parentMap)
    {
        this.parentMap = parentMap;
    }
}