public TriggerableObject( GameWorld world, bool invisible = true, String name = "TriggerableObject",
     String texture_name = TNames.trail )
     : base(name: name, texture_name: texture_name)
 {
     m_invisible = invisible;
     m_world = world;
 }
Beispiel #2
0
 public Selector( GameWorld world, Texture2D texture,
     Vector2 position, float radius, Editor edit )
     : base(world, texture,
         position, radius)
 {
     editor = edit;
 }
Beispiel #3
0
 public Trigger( GameWorld world, Texture2D active_texture,
     Texture2D inactive_texture, Vector2 position,
     TriggerableObject triggered_object, TriggerType type,
     float cooldown, float rotation, String name = "Trigger",
     String texture_name = TNames.ground_switch_animate, SharedResourceList<TriggerableObject> t_obj_list = null,
     float scale = 1, float density = DENSITY )
     : base(world, inactive_texture, position, name: name, texture_name: texture_name, density: density)
 {
     m_texture_name = texture_name;
     m_texture_name_helper = texture_name;
     m_active_texture = active_texture;
     m_inactive_texture = inactive_texture;
     m_buffered_position = position;
     m_size_scale = scale;
     m_radius = m_size_scale * ( m_texture.Width ) / ( GameWorld.SCALE * 2 );
     if ( t_obj_list == null ) {
         m_attached_to = new SharedResourceList<TriggerableObject>( world );
     }
     else {
         m_attached_to = t_obj_list;
     }
     if ( triggered_object != null ) {
         m_attached_to.Add( triggered_object );
     }
     m_type = type;
     m_cooldown = cooldown * 60;
     m_cooldown_timer = 0;
     m_deactivated = false;
     m_active = false;
     m_rotation = rotation;
     //m_radius = 0.2f * 5;
 }
Beispiel #4
0
        public GameObject( GameWorld world, Texture2D texture,
            float density = 1.0f, float friction = 0, float restitution = 0.7f,
            float damping = 0, float radius = 0, bool is_throwable = false,
            bool is_destructible = false, float destroy_threshold = 0.0f,
            float rotation = 0.0f, String name = "GameObject",
            String texture_name = "default" )
        {
            m_rotation = rotation;
            m_world = world;
            m_density = density;
            m_friction = friction;
            m_restitution = restitution;
            m_damping = damping;
            m_name = name;
            m_is_throwable = is_throwable;
            m_radius = radius;
            m_is_destructible = is_destructible;
            m_destroy_threshold = destroy_threshold;
            m_is_dead = false;
            m_is_added = false;
            m_buffered_angle = null;
            m_buffered_position = null;
            m_buffered_linear_velocity = null;
            if ( !Statics.object_name_list.Contains( m_name ) ) {
                Statics.object_name_list.Add( m_name );
            }

            if ( m_texture == null && ( String.Equals( texture_name, "default" ) || texture_name == null ) ) {
                m_texture_name_helper = TNames.ball;
            }
            else {
                m_texture_name_helper = texture_name;
            }
        }
 public BallSpawner( GameWorld world, Texture2D active_texture,
     Texture2D inactive_texture, Vector2[] points,
     float cooldown = 1, float rotation = 0, String name = "Trigger",
     String texture_name = TNames.ground_switch_inactive )
     : base(world, active_texture, inactive_texture, points, cooldown: 1)
 {
     ball_count = 0;
 }
Beispiel #6
0
 public BackHit( GameWorld world, Texture2D texture, Vector2 position, float size,
     AlienType type, String texturename = TNames.plated_alien )
     : base(world, texture, position, size,
     type, texturename: texturename, ai: AlienController.AIType.BOSS)
 {
     m_restitution = 1.2f;
     m_alien_color = Color.Aquamarine;
 }
Beispiel #7
0
 // The Ball Constructor
 // <param name="world"> The World this object would be contained inside
 // </param>
 // <param name="texture"> The image that governs the shape of this
 // object</param>
 // <param name="velocity"> The initial velocity upon spawning</param>
 // <param name="density"> The object's mass per unit area </param>
 // <param name="friction"> Usually set to 0 for throwable objects,
 // but sliding factor </param>
 // <param name="restitution"> Bounciness </param>
 public Ball( GameWorld world, Texture2D texture,
     Vector2 position, float radius, String name = "Ball", String texturename = TNames.ball )
     : base(world, texture, BALL_DENSITY, BALL_FRICTION,
     BALL_RESTITUTION, damping: BALL_DAMPING,
     radius: radius * BALL_SIZE_SCALE * GameWorld.OBJECT_SCALE,
     name: name, is_throwable: true, texture_name: texturename)
 {
     m_buffered_position = position;
 }
        public override void update( GameWorld world, float time_step )
        {
            if ( m_deactivated && m_cooldown_timer == 0 && m_cooldown > 0 ) {
                Ball ball = new Ball( world, TestWorld.ball_texture, m_body.Position, 2 );
                m_world.add_queued_object( ball );
                ball_list.AddLast( ball );
            }

            base.update( world, time_step );
        }
Beispiel #9
0
 public Spawner( GameWorld world, Texture2D texture, Vector2 position, float size,
     AlienType type, int cooldown, String texturename = TNames.easy_alien, int max_spawn = DEFAULT_MAX_SPAWN, AlienController.AIType ai = AlienController.AIType.PATROL, float patrol = 0.05f )
     : base(world, texture, position, size, type, ai: ai, patrol_speed: patrol)
 {
     m_texture_name = texturename;
     max_cool = cooldown;
     m_cooldown = cooldown;
     m_alien_color = Color.Red;
     m_max_spawn = max_spawn;
 }
Beispiel #10
0
 public MultiHit( GameWorld world, Texture2D texture, Vector2 position, float size,
     AlienType type, int hits, String texturename = TNames.plated_alien )
     : base(world, texture, position, size, type, ai: AlienController.AIType.CHASER)
 {
     max_hit = hits;
     hit_counter = hits;
     m_restitution = 1;
     m_texture_name = texturename;
     m_texture = texture;
 }
Beispiel #11
0
 // The DeathTouch Constructor
 //
 // <param name="world"> The World this object would be contained inside </param>
 // <param name="texture"> The image that governs the shape of this object</param>
 // <param name="velocity"> The initial velocity from throwing</param>
 // <param name="density"> The object's mass per unit area </param>
 // <param name="friction"> Usually set to 0 for throwable objects, but sliding factor </param>
 // <param name="restitution"> Bounciness </param>
 public DeathTouch( GameWorld world, Texture2D texture,
     Vector2 position, float radius, String name = "Ball", String texturename = TNames.plated_alien, float dense = 0 )
     : base(world, texture, dense, 0,
     0, radius: radius,
     name: name, texture_name: texturename)
 {
     m_buffered_position = position;
     m_size = Vector2.Zero;
     m_tint = Color.White;
 }
 public TriggerableObject( GameWorld world, Texture2D texture,
     Vector2 position, TriggerType type, float rotation = 0, bool invisible = false,
     String name = "TriggerableObject", String texture_name = TNames.bomb, int timer_set = 120 )
     : base(world, texture, position, name: name, texture_name: texture_name, density: DOOR_DENSITY)
 {
     m_timer_checkpoint_set = timer_set;
     m_invisible = invisible;
     m_type = type;
     m_is_active = false;
     m_radius = m_scale.Y * 4;
 }
Beispiel #13
0
     public MovingDeath( GameWorld world, Texture2D texture,
 Vector2 position, Vector2 size, Vector2 movedistance, float speed, String texturename = TNames.ball, bool starting = true )
         : base(world, texture, position, size, texturename: texturename)
     {
         returning = false;
         distance = movedistance.Length();
         movedistance.Normalize();
         direction = movedistance * speed;
         starting_pos = position;
         active = starting;
     }
 //A constructor for background tiles
 public BackgroundTile( GameWorld world, Texture2D texture,
  Vector2 position, Vector2 size, String name = "background_tile", String texturename = TNames.ground )
     : base(world, texture, 0, 0,
     0,
     name: name, texture_name: texturename, radius: 1)
 {
     m_buffered_position = position;
     m_size = size;
     m_scale = Vector2.One; //new Vector2(size.X / texture.Width, size.Y / texture.Height) * GameWorld.SCALE;
     m_tint = Color.White;
 }
Beispiel #15
0
 public TwinNova( GameWorld world, Texture2D texture, Vector2 position, float size,
     AlienType type, int deathtime, int hits, String texturename = TNames.blue_nova )
     : base(world, texture, position, size, type)
 {
     cooldown = deathtime;
     m_deathtime = deathtime;
     max_hit = hits;
     hit_counter = hits;
     m_restitution = 1.5f;
     m_texture_name = texturename;
     m_texture = texture;
 }
Beispiel #16
0
 public TrapTrigger( GameWorld world, Texture2D active_texture,
   Texture2D inactive_texture, Vector2[] points, Vector2 spawn, Vector2 impulse, float boul_radius, TriggerableObject triggered_object = null,
   String t_name = "Trigger", Trap type = Trap.BOULDER )
     : base(world, active_texture,
   inactive_texture, points, type: TriggerType.FLOOR, cooldown: 4, name: t_name,
   texture_name: TNames.ground_switch_inactive)
 {
     m_trap = type;
     m_impulse = impulse;
     m_spawn = spawn;
     obj_radius = boul_radius;
 }
Beispiel #17
0
     // Another constructor, for squareish objects
     public DeathTouch( GameWorld world, Texture2D texture,
 Vector2 position, Vector2 size, String name = "Floor", String texturename = TNames.tile, int pit_num = 0 )
         : base(world, texture, 0, 0,
         0,
         name: name, texture_name: texturename)
     {
         m_buffered_position = position;
         m_size = size;
         m_scale = new Vector2( size.X / texture.Width, size.Y / texture.Height ) * GameWorld.SCALE;
         m_saved_scale = m_scale;
         m_pit_num = pit_num - 1;
         m_tint = Color.White;
     }
Beispiel #18
0
        // The Ball Constructor
        // <param name="world"> The World this object would be contained inside
        // </param>
        // <param name="texture"> The image that governs the shape of this
        // object</param>
        // <param name="velocity"> The initial velocity upon spawning</param>
        // <param name="density"> The object's mass per unit area </param>
        // <param name="friction"> Usually set to 0 for throwable objects,
        // but sliding factor </param>
        // <param name="restitution"> Bounciness </param>
        public SelectBox( GameWorld world, Texture2D texture,
            Vector2 position, float radius, String name = "Ball", String texturename = TNames.tile, GameObject target = null )
            : base(world, texture, 0, 0,
            0,
            radius: radius,
            name: name, texture_name: texturename)
        {
            m_buffered_position = Vector2.Zero;
            m_draw_location = position;
            m_tint = new Color( 255, 255, 255, 150 );
            m_texture = TestWorld.floor_texture;
            m_radius = radius;

            m_target = target;
        }
Beispiel #19
0
        public static void create_quad_shape( GameWorld use_gameworld, Texture2D use_texture,
                                        Vector2 top_left_point, Vector2 top_right_point, Vector2 bottom_right_point, Vector2 bottom_left_point,
                                     float use_density = 1, float use_friction = 0, float use_restitution = 0.7f,
                                        bool if_breakable = false, float speed_required_to_break = 30 )
        {
            Vector2[] vertices = new Vector2[]
                                     {
                                         top_left_point, top_right_point,
                                         bottom_right_point,
                                         bottom_left_point
                                     };

            use_gameworld.add_queued_object( new PolygonObject( use_gameworld, vertices, use_texture,
                                             use_density, use_friction, use_restitution ) );
        }
        public PolygonObject( GameWorld world, Vertices points, Texture2D texture,
                             float density = 1.0f, float friction = 0, float restitution = 0.7f,
                             float destroy_threshold = 0.0f, String name = "PolygonObject",
                             String texture_name = TNames.wall )
            : base(world, texture, density, friction, restitution,
                   is_destructible: ( destroy_threshold > 0 ),
                   destroy_threshold: destroy_threshold, name: name, texture_name: texture_name)
        {
            List<PolygonPoint> polypoints = new List<PolygonPoint>();
            foreach ( Vector2 pt in points ) {
                polypoints.Add( new PolygonPoint( pt.X, pt.Y ) );
            }

            Polygon polygon = new Polygon( polypoints );
        }
        //----------------------------------------------------------------
        // Constructor
        //----------------------------------------------------------------
        //
        // Creates a new AlienController with the given parameters
        public AlienController( GameWorld world, Alien alien, AIType type,
            Ninja target, float patrol_speed = ALIEN_PATROL_SPEED, float max_range = TUTORIAL_MAX_RANGE,
            float attack_dist = TUTORIAL_ATTACK_RANGE, float chase_dist = TUTORIAL_MAX_CHASE )
            : base(ControllerType.AlienController)
        {
            m_world = world;
            m_self = alien;
            m_type = type;
            m_self.m_ai_type = m_type;

            if ( patrol_speed == 0 ) {
                m_self.m_move_step = ALIEN_PATROL_SPEED;

            }
            if ( max_range == 0 ) {
                m_self.m_range = TUTORIAL_MAX_RANGE;

            }
            if ( attack_dist == 0 ) {
                m_self.m_attack_dist = TUTORIAL_ATTACK_RANGE;

            }
            if ( chase_dist == 0 ) {
                m_self.m_chase_dist = TUTORIAL_MAX_CHASE;

            }

            m_start_rotation = alien.m_rotation;

            if ( alien is TwinNova ) {
                /*m_ai_move_step = m_self.m_move_step *= 0.75f;
                m_ai_range = m_self.m_range *= 1.5f;
                m_ai_attack_dist= m_self.m_attack_dist *= 0.75f;
                m_ai_chase_dist = m_self.m_chase_dist *= 1.5f; */
                m_type = AIType.BOSS;
            }
            m_ai_move_step = m_self.m_move_step;
            m_ai_range = m_self.m_range;
            m_ai_attack_dist = m_self.m_attack_dist;
            m_ai_chase_dist = m_self.m_chase_dist;

            //keep in line with the multiplier from before
            m_ai_move_step *= 0.67f;

            m_target = target;
            m_state = State.SPAWNING;
            m_origin = m_self.m_buffered_position.Value;
        }
 // Needs to change this
 public ConditionTriggered( GameWorld world, Texture2D texture,
     Vector2 pos, float rotation, SharedResourceList triglist, String name = "ConditionTrigger",
     String texture_name = TNames.ground_switch_inactive, float cooldown = -1,
     SharedResourceList<TriggerableObject> t_objects = null,
     ConditionType c_type = ConditionType.DEATH )
     : base(world, texture, texture, pos, null, TriggerType.NO_COLLISION, cooldown,
          rotation, texture_name: texture_name, t_obj_list: t_objects)
 {
     m_condition_type = c_type;
     if ( trigger_list != null ) {
         trigger_list = triglist;
     }
     else {
         trigger_list = new SharedResourceList( m_world );
     }
 }
Beispiel #23
0
        //--------------------------------------------------------------------
        // Member variables
        //--------------------------------------------------------------------
        //Create a Wall Line using 2 points, and adds it to the game world
        //Make texture null if you want to just use the default texture
        /// <summary>
        /// 
        /// </summary>
        /// <param name="use_gameworld"></param>
        /// <param name="top_left_point">top left point of wall</param>
        /// <param name="x_offset">how far right top right point is</param>
        /// <param name="y_offset">how far up top right point is</param>
        /// <param name="use_texture">texture used</param>
        /// <param name="thickness">thickness of the wall</param>
        /// <param name="use_density">density of the wall (force required to move, intertia)</param>
        /// <param name="use_friction">friction of the wall</param>
        /// <param name="use_restitution">restitution (bounciness) of the wall</param>
        public static void create_wall_line( GameWorld use_gameworld, Texture2D use_texture, Vector2 top_left_point, float x_right_offset, float y_up_offset, float thickness,
                                     float use_density = 1, float use_friction = 0, float use_restitution = 0.7f,
                                        bool if_breakable = false, float speed_required_to_break = 30 )
        {
            Vector2 thickness_vector = new Vector2( 0, thickness );
            Vector2 top_right_point = top_left_point + new Vector2( x_right_offset, -y_up_offset );
            Vector2[] vertices = new Vector2[]
                                     {
                                         top_left_point, top_right_point,
                                         top_right_point + thickness_vector,
                                         top_left_point + thickness_vector
                                     };

            use_gameworld.add_queued_object( new PolygonObject( use_gameworld, vertices, use_texture,
                                             use_density, use_friction, use_restitution ) );
        }
 // Needs to change this
 public TriggerableObject( GameWorld world, Texture2D texture, Vector2 vertex1,
     Vector2 vertex2, float rotation = 0, String name = "TriggerableObject", bool invisible = false,
     String texture_name = TNames.door, int timer_set = 120 )
     : base(world, texture, name: name, texture_name: texture_name)
 {
     m_timer_checkpoint_set = timer_set;
     m_invisible = invisible;
     m_length = ( Math.Abs( vertex1.X - vertex2.X ) >
         Math.Abs( vertex1.Y - vertex2.Y ) ) ?
         Math.Abs( vertex1.X - vertex2.X ) :
         Math.Abs( vertex1.Y - vertex2.Y );
     m_rotation = rotation;
     m_buffered_position = ( vertex1 + vertex2 ) / 2;
     float scale = ( m_length / m_texture.Width ) * GameWorld.SCALE;
     m_scale = new Vector2( scale, scale );
     m_radius = m_scale.Y * 4;
 }
        public PolygonTrigger( GameWorld world, Texture2D active_texture,
            Texture2D inactive_texture, Vector2[] points, TriggerableObject triggered_object = null,
            TriggerType type = TriggerType.FLOOR, float cooldown = -1, float rotation = 0, String name = "Trigger",
            String texture_name = TNames.ground_switch_inactive )
            : base(world, active_texture, inactive_texture, Vector2.Zero, triggered_object, type, cooldown, rotation, name, texture_name)
        {
            Vector2 diff = points[0] - points[(int)Math.Ceiling( points.Length / 2f )];
            float multiplier = Math.Min( Math.Abs( diff.X ), Math.Abs( diff.Y ) );
            m_width_height = new Vector2( multiplier, multiplier ) * 2;

            Vector2 sum = Vector2.Zero;

            foreach ( Vector2 p in points ) {
                sum += p;
            }
            pos = sum / points.Length;
            m_position = pos;

            for ( int i = 0; i < points.Length; i++ ) {
                points[i] -= pos;

            }

            if ( texture_name == TNames.wall && m_is_destructible ) {

                m_texture_name_change = TNames.breakwall;
                //m_texture = GameScreen.GAME_CONTENT.Load<Texture2D>(m_texture_name);
            }
            else if ( texture_name == TNames.tile ) {
                m_texture_name_change = TNames.tile;
                //m_texture = GameScreen.GAME_CONTENT.Load<Texture2D>(m_texture_name);

            }
            m_points = points;

            Vertices verts = new Vertices( points );
            Vertices collinear_simplified = SimplifyTools.CollinearSimplify( verts );
            Vertices merge_simplified = SimplifyTools.MergeIdenticalPoints( collinear_simplified );
            //Since it is a concave polygon, we need to partition it into several smaller convex polygons
            //List<Vertices> vert_list = BayazitDecomposer.ConvexPartition(merge_simplified);

            verts = merge_simplified;
            verts.ForceCounterClockWise();
            m_points = verts.ToArray();
        }
Beispiel #26
0
        public Queen( GameWorld world, Texture2D texture, Vector2 position, float size,
            AlienType type, int cooldown, String texturename = TNames.queen_alien, int max_spawn = 10 )
            : base(world, texture, position, size,
            type, cooldown, texturename: texturename, max_spawn: max_spawn, ai: AlienController.AIType.BOSS, patrol: 0.03f)
        {
            m_alien_color = Color.White;
            m_restitution = 2f;
            for ( int i = 0; i < 4; i++ ) {
                eggs[i] = new Egg();
                eggs[i].intact = true;
                eggs[i].pos = Vector2.Zero;
            }

            eggs[0].pos += new Vector2( 9, -4 );
            eggs[0].angle = 1.35f;
            eggs[1].pos += new Vector2( 7, -10 );
            eggs[1].angle = 0.65f;

            eggs[2].pos += new Vector2( -9, -4 );
            eggs[2].angle = -1.35f;
            eggs[3].pos += new Vector2( -7, -10 );
            eggs[3].angle = -0.65f;
        }
Beispiel #27
0
 public override void update( GameWorld world, float time_step )
 {
     if ( m_target != null ) {
         m_draw_location = m_target.m_position;
     }
     base.update( world, time_step );
 }
Beispiel #28
0
        // The Ninja Constructor
        // <param name="world"> The World this object would be contained
        // inside </param>
        // <param name="texture"> The image that governs the shape of this
        // object</param>
        // <param name="velocity"> The initial velocity from throwing</param>
        // <param name="density"> The object's mass per unit area </param>
        // <param name="friction"> Usually set to 0 for throwable objects,
        // but sliding factor </param>
        // <param name="restitution"> Bounciness </param>
        public Ninja( GameWorld world, Texture2D texture, Vector2 position,
            float radius, float throw_power = NINJA_THROW_POWER, float move_force = NINJA_FORCE,
            float maxspeed = NINJA_MAXSPEED, int capacity = NINJA_MAXTHROWABLE_CAPACITY,
            String name = "Ninja", String texture_name = TNames.ninja_animate, float boost = 50 )
            : base(world, texture, NINJA_DENSITY, NINJA_FRICTION,
                    NINJA_RESTITUTION, name: name, texture_name: texture_name)
        {
            m_throw_power = throw_power;
            m_movement_accel = move_force;
            m_maxspeed = maxspeed;
            m_max_throwable_capacity = capacity;
            throwable_objects = m_throwing_items;
            m_boost_amt = boost;

            m_buffered_position = position;
            m_radius = radius * NINJA_SIZE_SCALE;
            m_has_item = m_throwing_items.Count > 0;
            m_facing_angle = (float)Math.PI / 2;
            m_picking_up = true;
            m_cruise_cooldown = 255;

            m_speed_trail = new PhotonTrailQueue( GameScreen.GAME_CONTENT.Load<Texture2D>( TNames.trail ), position );
            m_sonicboom = new SonicBoom( GameScreen.GAME_CONTENT.Load<Texture2D>( TNames.sonic_boom ) );
        }
Beispiel #29
0
        public override void Update( GameTime game_time )
        {
            if ( editor_mode ) {
                editor.Update2();
                //Update ninja bindings
                editor.ninjaBindingSource.EndEdit();
                editor.alienBindingSource.EndEdit();
                editor.floorTileBindingSource.EndEdit();
                editor.gameObjectBindingSource.EndEdit();
                editor.polygonObjectBindingSource.EndEdit();
                editor.triggerBindingSource.EndEdit();
                editor.triggerableObjectBindingSource.EndEdit();
                editor.m_pointsBindingSource.EndEdit();
            }

            if ( m_current_world != null ) {
                if ( !m_current_world.m_succeeded &&
                    !m_current_world.m_failed && !m_paused ) {
                    //------------------------------------------------------------
                    // Logic for Timer
                    //------------------------------------------------------------
                    if ( m_timer.m_is_active == false ) {
                        m_timer.set( 121 );
                    }
                    else if ( !m_halted ) {
                        m_timer.check_timer( game_time );
                    }

                    //if ( m_current_world.m_ninja != null )
                    //{
                    //    m_power_bar.m_ninja = m_current_world.m_ninja;
                    //}
                    //m_power_bar.update( game_time );

                    m_current_world.simulate( (float)game_time.ElapsedGameTime.TotalSeconds );

                }
            }
            else {
                float time = GameEngine.LevelManager.timer_select();
                m_checkpoint_timer = (int)Math.Ceiling( time );
                m_timer.set( time );

                m_current_world =
                    new TestWorld( GameScreen.m_curr_view, editor,
                        GameEngine.LevelManager.get_current_level() );
                m_background =
                    GAME_CONTENT.Load<Texture2D>(
                    GameEngine.LevelManager.background_texture
                    );
            }
        }
Beispiel #30
0
        public override void HandleInput( InputState input )
        {
            // Move to the previous level?
            /*  if (input.PreviousLevel) {
                  m_current_level--;

                  if (m_current_level < 0)
                      m_current_level = m_worlds.Length - 1;
              }
            */
            // Move to the next level?

            //Disables inputs if editor has focus
            if ( !m_editor_focused ) {
                if ( input.NextLevel && m_current_world.m_succeeded )
                {
                    GameEngine.LevelManager.next_level();
                    if ( GameEngine.LevelManager.get_current_level().Equals( "end" ) )
                    {
                        GameEngine.AudioManager.Stop();
                        ScreenManager.AddScreen( new EndScreen() );
                        ScreenManager.RemoveScreen( this );
                    }
                    else
                    {
                        float time = GameEngine.LevelManager.timer_select();
                        m_timer.set( time );
                        m_checkpoint_timer = (int)Math.Ceiling( time );
                        m_current_world = new TestWorld( GameScreen.m_curr_view, editor,
                                                        GameEngine.LevelManager.get_current_level() );
                        m_background =
                            GAME_CONTENT.Load<Texture2D>( GameEngine.LevelManager.background_texture );
                    }
                }
                if ( input.PauseGame ) {
                    m_paused = !m_paused;
                }
                if ( input.HaltControllers ) {
                    m_halted = !m_halted;
                }

                if ( input.ResetLevel ) {
                    float time = GameEngine.LevelManager.timer_select();
                    m_timer.set( time );
                    m_paused = false;
                    if ( m_current_world.curr_filename != null
                        && m_current_world.curr_filename != "" ) {
                        try {
                            m_current_world =
                                new TestWorld( GameScreen.m_curr_view, editor,
                                               m_current_world.curr_filename, teleport_camera: false );
                            m_background =
                                GAME_CONTENT.Load<Texture2D>(
                                GameEngine.LevelManager.background_texture
                                );
                            m_timer.set( m_checkpoint_timer );
                        }
                        catch {
                            m_current_world =
                                new TestWorld( GameScreen.m_curr_view, editor,
                                               GameEngine.LevelManager.get_current_level(), teleport_camera: false);

                            m_background =
                                GAME_CONTENT.Load<Texture2D>(
                                GameEngine.LevelManager.background_texture
                                );
                            m_checkpoint_timer = (int)Math.Ceiling( time );
                            Console.WriteLine(
                                "ERROR when loading level. Aborting to the beginning"
                                );
                        }
                    }
                    else {
                        m_checkpoint_timer = (int)Math.Ceiling( time );
                        m_current_world =
                            new TestWorld( GameScreen.m_curr_view, editor,
                                           GameEngine.LevelManager.get_current_level(), teleport_camera: false);

                        m_background = GAME_CONTENT.Load<Texture2D>(
                            GameEngine.LevelManager.background_texture
                            );
                    }
                }

                if ( input.RestartLevel && m_paused ) {
                    float time = GameEngine.LevelManager.timer_select();
                    m_checkpoint_timer = (int)Math.Ceiling( time );
                    m_timer.set( time );
                    m_paused = false;
                    m_current_world =
                        new TestWorld( GameScreen.m_curr_view, editor,
                                       GameEngine.LevelManager.get_current_level() );
                    m_background = GAME_CONTENT.Load<Texture2D>(
                        GameEngine.LevelManager.background_texture
                        );
                }

                if ( input.ToggleEditMode ) {
                    editor.clearLine();
                    System.Drawing.Point loc =
                        Form.FromHandle( GameEngine.GameWindow.Handle ).Location;
                    if ( !editor_mode ) {
                        editor.Show();
                        editor.TopMost = true;
                    }
                    else {
                        FORM_OFFSET = 0;
                        editor.Hide();
                    }
                    editor_mode = !editor_mode;
                }

                if ( editor_mode ) {
                    if ( input.editor_hide_show ) {
                        editor.Visible = !editor.Visible;
                    }
                    //BLAH
                    editor_camera_movement = Vector2.Zero;
                    if ( input.MoveUp )
                        editor_camera_movement.Y--;
                    if ( input.MoveDown )
                        editor_camera_movement.Y++;
                    if ( input.MoveLeft )
                        editor_camera_movement.X--;
                    if ( input.MoveRight )
                        editor_camera_movement.X++;
                    if ( input.ZoomIn )
                        m_curr_view.m_camera_zoom =
                            Math.Min( m_curr_view.m_camera_zoom + 0.1f, 0.8f );
                    if ( input.ZoomOut )
                        m_curr_view.m_camera_zoom =
                            Math.Max( m_curr_view.m_camera_zoom - 0.1f, 0.15f );
                    m_curr_view.m_camera_position +=
                        editor_camera_movement * 30 / m_curr_view.m_camera_zoom;

                    if ( editor.currentTool == Editor.EditorTool.Selection
                        && editor.current_selector != null ) {
                        if ( input.LeftMouseClick
                            && editor.current_selector.m_body != null
                            && editor.current_selector.m_body.FixtureList != null ) {
                            editor.current_selector.m_body.Position = editor.getMouse();
                        }
                    }
                }
                else {
                    if ( m_current_world != null ) {
                        m_current_world.m_ninja_controller.HandleInput( input );
                    }
                }

            }
            // Accept or cancel the menu?
            if ( input.MenuCancel ) {
                OnCancel();
            }

            base.HandleInput( input );
        }