//-------------------------------------------------------------- //操控 // //............................................................... public static void key_ctrl(Player[] player, Map[] map, Npc[] npc, KeyEventArgs e) { if (Player.status != Status.WALK) { return; } Player p = player[current_player]; //切换角色 if (e.KeyCode == Keys.Tab) { key_change_player(player); } //是否转向 if (e.KeyCode == Keys.Up) { walk(player, map, Comm.Direction.UP); } else if (e.KeyCode == Keys.Down) { walk(player, map, Comm.Direction.DOWN); } else if (e.KeyCode == Keys.Left) { walk(player, map, Comm.Direction.LEFT); } else if (e.KeyCode == Keys.Right) { walk(player, map, Comm.Direction.RIGHT); } else if (e.KeyCode == Keys.Escape) { Statusmenu.show(); Task.block(); } //npc碰撞 npc_collision(player, map, npc, e); /* * //间隔判定 * if (Comm.Time() - p.last_walk_time <= p.walk_interval) * return; * //移动处理 * if (e.KeyCode == Keys.Down && Map.can_through(map,p.x,p.y+p.speed)) { p.y = p.y + p.speed; } // p.face = 1; } * else if (e.KeyCode == Keys.Up && Map.can_through(map, p.x, p.y - p.speed)) { p.y = p.y - p.speed; } //p.face = 4; } * else if (e.KeyCode == Keys.Left && Map.can_through(map, p.x-p.speed, p.y)) { p.x = p.x - p.speed; } //p.face = 2; } * else if (e.KeyCode == Keys.Right && Map.can_through(map, p.x+p.speed, p.y)) { p.x = p.x + p.speed; } //p.face = 3; } * else return; * //动画帧 * p.anm_frame = p.anm_frame + 1; * if (p.anm_frame >= int.MaxValue) p.anm_frame = 0; * //时间 * p.last_walk_time = Comm.Time(); */ }
public static void mouse_click(Map[] map, Player[] player, Rectangle stage, MouseEventArgs e) { if (Player.status != Status.WALK) { return; } if (e.Button == MouseButtons.Left) { target_x = e.X - Map.get_map_sx(map, player, stage); target_y = e.Y - Map.get_map_sy(map, player, stage); flag_start_time = Comm.Time(); } else if (e.Button == MouseButtons.Right) { Statusmenu.show(); Task.block(); } }