|
@@ -1,5 +1,5 @@
|
|
|
function player_move_and_collide()
|
|
function player_move_and_collide()
|
|
|
-{
|
|
|
|
|
|
|
+{
|
|
|
if place_meeting(x, y + y_spd, oParentSolid)
|
|
if place_meeting(x, y + y_spd, oParentSolid)
|
|
|
{
|
|
{
|
|
|
while !place_meeting(x, y + sign(y_spd), oParentSolid)
|
|
while !place_meeting(x, y + sign(y_spd), oParentSolid)
|
|
@@ -28,7 +28,8 @@ function player_move_and_collide()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
x += x_spd;
|
|
x += x_spd;
|
|
|
- function player_state_update()
|
|
|
|
|
|
|
+}
|
|
|
|
|
+function player_state_update()
|
|
|
{
|
|
{
|
|
|
current_attacker = instance_place(x, y, oEnemyHitbox);
|
|
current_attacker = instance_place(x, y, oEnemyHitbox);
|
|
|
|
|
|
|
@@ -106,8 +107,8 @@ function state_free()
|
|
|
if _current_sprite != sprite_index
|
|
if _current_sprite != sprite_index
|
|
|
image_index = 0;
|
|
image_index = 0;
|
|
|
/**/
|
|
/**/
|
|
|
- player_check_dodge_y();
|
|
|
|
|
- if state == player_dodge_y return;
|
|
|
|
|
|
|
+ player_check_dodge();
|
|
|
|
|
+ if state == player_dodge return;
|
|
|
|
|
|
|
|
player_check_movement();
|
|
player_check_movement();
|
|
|
player_check_dash();
|
|
player_check_dash();
|
|
@@ -118,14 +119,16 @@ function state_dash()
|
|
|
{
|
|
{
|
|
|
y_spd += 0.2 * global.g;
|
|
y_spd += 0.2 * global.g;
|
|
|
icl(oPlayerAfterImage);
|
|
icl(oPlayerAfterImage);
|
|
|
- if !_on_ground
|
|
|
|
|
- jump_cnt = max(jump_cnt, 1);
|
|
|
|
|
|
|
+
|
|
|
if animation_end()
|
|
if animation_end()
|
|
|
{
|
|
{
|
|
|
|
|
+ if !_on_ground
|
|
|
|
|
+ jump_cnt = max(jump_cnt, 1);
|
|
|
|
|
+
|
|
|
state = state_free;
|
|
state = state_free;
|
|
|
player_check_attack();
|
|
player_check_attack();
|
|
|
}
|
|
}
|
|
|
- player_check_dodge_y();
|
|
|
|
|
|
|
+ player_check_dodge();
|
|
|
}
|
|
}
|
|
|
function state_attack()
|
|
function state_attack()
|
|
|
{
|
|
{
|
|
@@ -135,58 +138,39 @@ function state_attack()
|
|
|
|
|
|
|
|
if image_index == 1
|
|
if image_index == 1
|
|
|
{
|
|
{
|
|
|
- var _up = oInput._up;
|
|
|
|
|
- var _down = oInput._down;
|
|
|
|
|
-
|
|
|
|
|
- var _hb = icd(oPlayerHitboxRec);
|
|
|
|
|
- _hb.owner = id;
|
|
|
|
|
-
|
|
|
|
|
- var _base = 2;
|
|
|
|
|
-
|
|
|
|
|
- if _up
|
|
|
|
|
|
|
+ var _hb;
|
|
|
|
|
+ if oInput._down && !_on_ground
|
|
|
{
|
|
{
|
|
|
- _hb.y -= 64;
|
|
|
|
|
- _hb.image_xscale = 72 / _base;
|
|
|
|
|
- _hb.image_yscale = 224 / _base;
|
|
|
|
|
-
|
|
|
|
|
- _hb.kb_dir_x = 0;
|
|
|
|
|
- _hb.kb_dir_y = -1;
|
|
|
|
|
- }
|
|
|
|
|
- else if _down && !_on_ground
|
|
|
|
|
|
|
+ _hb = icl(oPlayerHitboxVer, x, y + 64);
|
|
|
|
|
+ _hb.y_offset = 64;
|
|
|
|
|
+ }
|
|
|
|
|
+ else if oInput._up
|
|
|
{
|
|
{
|
|
|
- _hb.y += 64;
|
|
|
|
|
- _hb.image_xscale = 72 / _base;
|
|
|
|
|
- _hb.image_yscale = 224 / _base;
|
|
|
|
|
-
|
|
|
|
|
- _hb.kb_dir_x = 0;
|
|
|
|
|
- _hb.kb_dir_y = 1;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
|
|
+ _hb = icl(oPlayerHitboxVer, x, y - 64);
|
|
|
|
|
+ _hb.y_offset = -64;
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
{
|
|
{
|
|
|
- _hb.x += 72 * facing;
|
|
|
|
|
- _hb.image_xscale = 144 / _base * facing;
|
|
|
|
|
- _hb.image_yscale = 96 / _base;
|
|
|
|
|
|
|
+ _hb = icl(oPlayerHitboxHor, x + 72 * facing);
|
|
|
|
|
+ _hb.x_offset += 72 * facing;
|
|
|
|
|
|
|
|
- _hb.kb_dir_x = facing;
|
|
|
|
|
- _hb.kb_dir_y = 0;
|
|
|
|
|
- }
|
|
|
|
|
- //攻击碰撞箱跟随
|
|
|
|
|
- _hb.x_offset = _hb.x - x;
|
|
|
|
|
- _hb.y_offset = _hb.y - y;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ _hb.kb_factor_x *= facing;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ _hb.owner = id;
|
|
|
|
|
+ }
|
|
|
// 冲刺预输入 & 预读帧数
|
|
// 冲刺预输入 & 预读帧数
|
|
|
if image_index >= 2
|
|
if image_index >= 2
|
|
|
- {
|
|
|
|
|
- with(oPlayerHitboxRec)
|
|
|
|
|
- {
|
|
|
|
|
- instance_destroy();
|
|
|
|
|
- }
|
|
|
|
|
player_check_dash();
|
|
player_check_dash();
|
|
|
- }
|
|
|
|
|
// 攻击后摇结束
|
|
// 攻击后摇结束
|
|
|
if animation_end()
|
|
if animation_end()
|
|
|
state = state_free;
|
|
state = state_free;
|
|
|
}
|
|
}
|
|
|
|
|
+function state_locked()
|
|
|
|
|
+{
|
|
|
|
|
+ x_spd = 0;
|
|
|
|
|
+ y_spd += global.g;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
function player_check_dash()
|
|
function player_check_dash()
|
|
|
{
|
|
{
|
|
@@ -208,32 +192,6 @@ function player_check_movement()
|
|
|
if move_lock_timer <= 0
|
|
if move_lock_timer <= 0
|
|
|
x_spd = _move_dir * walk_spd;
|
|
x_spd = _move_dir * walk_spd;
|
|
|
}
|
|
}
|
|
|
-function player_check_attacked()
|
|
|
|
|
-{
|
|
|
|
|
- if current_attacker == noone || is_invincible
|
|
|
|
|
- || state == player_dodge_y
|
|
|
|
|
- return;
|
|
|
|
|
-
|
|
|
|
|
- global.playerHP -= current_attacker.damage;
|
|
|
|
|
- is_invincible = true;
|
|
|
|
|
- alarm[0] = 80;
|
|
|
|
|
-
|
|
|
|
|
- var _dir = sign(x - current_attacker.x);
|
|
|
|
|
- if _dir == 0
|
|
|
|
|
- _dir = facing;
|
|
|
|
|
-
|
|
|
|
|
- global.hitstop = 12;
|
|
|
|
|
-
|
|
|
|
|
- x_spd = _dir * 30;
|
|
|
|
|
- y_spd = -5;
|
|
|
|
|
-
|
|
|
|
|
- state = player_hitstun;
|
|
|
|
|
-
|
|
|
|
|
- sprite_index = sPlayerHitstun;
|
|
|
|
|
- image_speed = 1;
|
|
|
|
|
- image_index = 0;
|
|
|
|
|
- //effects
|
|
|
|
|
-}
|
|
|
|
|
function player_check_jump()
|
|
function player_check_jump()
|
|
|
{
|
|
{
|
|
|
if oInput.jump_buffer_timer > 0
|
|
if oInput.jump_buffer_timer > 0
|
|
@@ -277,21 +235,75 @@ function player_check_attack()
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function player_check_attacked()
|
|
|
|
|
+{
|
|
|
|
|
+ if current_attacker == noone || is_invincible
|
|
|
|
|
+ || state == player_dodge
|
|
|
|
|
+ return;
|
|
|
|
|
+
|
|
|
|
|
+ global.playerHP -= current_attacker.damage;
|
|
|
|
|
+ is_invincible = true;
|
|
|
|
|
+ alarm[0] = 80;
|
|
|
|
|
+
|
|
|
|
|
+ var _dir = sign(x - current_attacker.x);
|
|
|
|
|
+ if _dir == 0
|
|
|
|
|
+ _dir = facing;
|
|
|
|
|
+
|
|
|
|
|
+ global.hitstop = 12;
|
|
|
|
|
+
|
|
|
|
|
+ x_spd = _dir * 30;
|
|
|
|
|
+ y_spd = -5;
|
|
|
|
|
+
|
|
|
|
|
+ state = player_hitstun_attacked;
|
|
|
|
|
+
|
|
|
|
|
+ sprite_index = sPlayerHitstunAttacked;
|
|
|
|
|
+ image_speed = 1;
|
|
|
|
|
+ image_index = 0;
|
|
|
|
|
+ //effects
|
|
|
|
|
+}
|
|
|
|
|
+function player_check_hazard()
|
|
|
|
|
+{
|
|
|
|
|
+ var _hazard = instance_place(x, y, oParentHazard);
|
|
|
|
|
+
|
|
|
|
|
+ if _hazard != noone
|
|
|
|
|
+ {
|
|
|
|
|
+ global.playerHP -= _hazard.damage;
|
|
|
|
|
+
|
|
|
|
|
+ is_invincible = true;
|
|
|
|
|
+ alarm[0] = 150;
|
|
|
|
|
+
|
|
|
|
|
+ var _dir = sign(x - _hazard.x);
|
|
|
|
|
+ if _dir == 0
|
|
|
|
|
+ _dir = facing;
|
|
|
|
|
+
|
|
|
|
|
+ global.hitstop = 18;
|
|
|
|
|
+
|
|
|
|
|
+ x_spd = _dir * 10;
|
|
|
|
|
+ y_spd = -10;
|
|
|
|
|
+
|
|
|
|
|
+ state = player_hitstun_hazard;
|
|
|
|
|
+
|
|
|
|
|
+ sprite_index = sPlayerHitstunHazard;
|
|
|
|
|
+ image_speed = 1;
|
|
|
|
|
+ image_index = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function player_perform_pogo()
|
|
function player_perform_pogo()
|
|
|
{
|
|
{
|
|
|
y_spd = jump_spd * 0.8;
|
|
y_spd = jump_spd * 0.8;
|
|
|
jump_cnt = 1;
|
|
jump_cnt = 1;
|
|
|
can_dash = true;
|
|
can_dash = true;
|
|
|
coyote_timer = 0;
|
|
coyote_timer = 0;
|
|
|
- //hitstop = 3;
|
|
|
|
|
|
|
+ global.hitstop = 3;
|
|
|
}
|
|
}
|
|
|
function player_perform_recoil()
|
|
function player_perform_recoil()
|
|
|
{
|
|
{
|
|
|
- x_spd = -image_xscale * 3;
|
|
|
|
|
|
|
+ x_spd = - facing * 3;
|
|
|
move_lock_timer = 6;
|
|
move_lock_timer = 6;
|
|
|
- //hitstop = 3;
|
|
|
|
|
|
|
+ global.hitstop = 2;
|
|
|
}
|
|
}
|
|
|
-function player_hitstun()
|
|
|
|
|
|
|
+function player_hitstun_attacked()
|
|
|
{
|
|
{
|
|
|
x_spd = lerp(x_spd, 0, 0.1);
|
|
x_spd = lerp(x_spd, 0, 0.1);
|
|
|
y_spd += global.g;
|
|
y_spd += global.g;
|
|
@@ -299,14 +311,32 @@ function player_hitstun()
|
|
|
if animation_end()
|
|
if animation_end()
|
|
|
state = state_free;
|
|
state = state_free;
|
|
|
}
|
|
}
|
|
|
|
|
+function player_hitstun_hazard()
|
|
|
|
|
+{
|
|
|
|
|
+ x_spd = lerp(x_spd, 0, 0.1);
|
|
|
|
|
+ y_spd += global.g;
|
|
|
|
|
+
|
|
|
|
|
+ if animation_end()
|
|
|
|
|
+ {
|
|
|
|
|
+ alarm[1] = 60;
|
|
|
|
|
+ state = state_locked;
|
|
|
|
|
+ var _fade = icl(oFade);
|
|
|
|
|
+ _fade._callback = function()
|
|
|
|
|
+ {
|
|
|
|
|
+ oPlayer.x = 160;//oPlayer.last_safe_x;
|
|
|
|
|
+ oPlayer.y = 2016;//oPlayer.last_safe_y;
|
|
|
|
|
+ camera_snap();
|
|
|
|
|
+ };
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
-function player_check_dodge_y()
|
|
|
|
|
|
|
+function player_check_dodge()
|
|
|
{
|
|
{
|
|
|
if (oInput._down || oInput._up) && _on_ground
|
|
if (oInput._down || oInput._up) && _on_ground
|
|
|
&& (oInput._dash || state == state_dash)
|
|
&& (oInput._dash || state == state_dash)
|
|
|
{
|
|
{
|
|
|
- state = player_dodge_y;
|
|
|
|
|
- sprite_index = sPlayerDodgeYWait;
|
|
|
|
|
|
|
+ state = player_dodge;
|
|
|
|
|
+ sprite_index = sPlayerDodgeWait;
|
|
|
image_index = 0;
|
|
image_index = 0;
|
|
|
image_speed = 1;
|
|
image_speed = 1;
|
|
|
|
|
|
|
@@ -315,22 +345,25 @@ function player_check_dodge_y()
|
|
|
marked_target = noone;
|
|
marked_target = noone;
|
|
|
is_marked = false;
|
|
is_marked = false;
|
|
|
is_perfect = false;
|
|
is_perfect = false;
|
|
|
|
|
+
|
|
|
|
|
+ var _hb = icl(oPlayerHitboxMark, x + facing * 60, y + 40);
|
|
|
|
|
+ _hb.owner = id;
|
|
|
|
|
+ _hb.x_offset = 60 * facing;
|
|
|
|
|
+ _hb.y_offset = 40;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-function player_dodge_y()
|
|
|
|
|
|
|
+function player_dodge()
|
|
|
{
|
|
{
|
|
|
if dodge_phase == "WAIT"
|
|
if dodge_phase == "WAIT"
|
|
|
{
|
|
{
|
|
|
x_spd = 0;
|
|
x_spd = 0;
|
|
|
- if !is_marked
|
|
|
|
|
- player_check_mark_y();
|
|
|
|
|
|
|
|
|
|
if current_attacker != noone || animation_end()
|
|
if current_attacker != noone || animation_end()
|
|
|
{
|
|
{
|
|
|
y_spd = jump_spd;
|
|
y_spd = jump_spd;
|
|
|
dodge_phase = "DODGE";
|
|
dodge_phase = "DODGE";
|
|
|
|
|
|
|
|
- sprite_index = sPlayerDodgeYDodge;
|
|
|
|
|
|
|
+ sprite_index = sPlayerDodge;
|
|
|
image_index = 0;
|
|
image_index = 0;
|
|
|
|
|
|
|
|
if current_attacker != noone && is_marked
|
|
if current_attacker != noone && is_marked
|
|
@@ -364,8 +397,8 @@ function player_dodge_y()
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
- state = player_dodge_y_ending;
|
|
|
|
|
- sprite_index = sPlayerDodgeYEnding;
|
|
|
|
|
|
|
+ state = player_dodge_ending;
|
|
|
|
|
+ sprite_index = sPlayerDodgeEnding;
|
|
|
image_index = 0;
|
|
image_index = 0;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -375,13 +408,22 @@ function player_arc_slash()
|
|
|
{
|
|
{
|
|
|
if image_index == 7
|
|
if image_index == 7
|
|
|
{
|
|
{
|
|
|
- var _hb = icd(oPlayerHitboxArc);
|
|
|
|
|
|
|
+ var _hb = icl(oPlayerHitboxArc);
|
|
|
_hb.owner = id;
|
|
_hb.owner = id;
|
|
|
|
|
|
|
|
if facing == 1
|
|
if facing == 1
|
|
|
|
|
+ {
|
|
|
_hb.image_xscale = 1;
|
|
_hb.image_xscale = 1;
|
|
|
|
|
+ _hb.image_angle = 30;
|
|
|
|
|
+ _hb.kb_factor_x *= 1;
|
|
|
|
|
+ }
|
|
|
else
|
|
else
|
|
|
- _hb.image_xscale = -1;
|
|
|
|
|
|
|
+ {
|
|
|
|
|
+ _hb.image_xscale = -1;
|
|
|
|
|
+ _hb.image_angle = -30;
|
|
|
|
|
+ _hb.kb_factor_x *= -1;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
else if animation_end()
|
|
else if animation_end()
|
|
|
{
|
|
{
|
|
@@ -389,34 +431,32 @@ function player_arc_slash()
|
|
|
state = state_free;
|
|
state = state_free;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-function player_dodge_y_ending()
|
|
|
|
|
|
|
+function player_dodge_ending()
|
|
|
{
|
|
{
|
|
|
if animation_end()
|
|
if animation_end()
|
|
|
state = state_free;
|
|
state = state_free;
|
|
|
}
|
|
}
|
|
|
-function player_check_mark_y()
|
|
|
|
|
|
|
+function player_check_mark()
|
|
|
{
|
|
{
|
|
|
- // 定义矩形相对于玩家中心的偏移和尺寸
|
|
|
|
|
|
|
+
|
|
|
|
|
+ /*
|
|
|
var _width = 2 * (72 + 16);
|
|
var _width = 2 * (72 + 16);
|
|
|
var _height = 64;
|
|
var _height = 64;
|
|
|
var _x_offset = facing * (36 + 16);
|
|
var _x_offset = facing * (36 + 16);
|
|
|
var _y_offset = 0;
|
|
var _y_offset = 0;
|
|
|
|
|
|
|
|
- // 计算出矩形的四个边界坐标
|
|
|
|
|
var x1 = x + _x_offset - (_width / 2);
|
|
var x1 = x + _x_offset - (_width / 2);
|
|
|
var y1 = y + _y_offset;
|
|
var y1 = y + _y_offset;
|
|
|
var x2 = x + _x_offset + (_width / 2);
|
|
var x2 = x + _x_offset + (_width / 2);
|
|
|
var y2 = y + _y_offset + _height;
|
|
var y2 = y + _y_offset + _height;
|
|
|
|
|
|
|
|
- // 将这些坐标存入变量
|
|
|
|
|
debug_hitbox_x1 = x1;
|
|
debug_hitbox_x1 = x1;
|
|
|
debug_hitbox_y1 = y1;
|
|
debug_hitbox_y1 = y1;
|
|
|
debug_hitbox_x2 = x2;
|
|
debug_hitbox_x2 = x2;
|
|
|
debug_hitbox_y2 = y2;
|
|
debug_hitbox_y2 = y2;
|
|
|
|
|
|
|
|
- // 执行核心碰撞检测
|
|
|
|
|
var _target = collision_rectangle(x1, y1, x2, y2, oParentEnemy, false, true);
|
|
var _target = collision_rectangle(x1, y1, x2, y2, oParentEnemy, false, true);
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if _target != noone
|
|
if _target != noone
|
|
|
{
|
|
{
|
|
|
is_marked = true;
|
|
is_marked = true;
|
|
@@ -424,4 +464,6 @@ function player_check_mark_y()
|
|
|
// animation
|
|
// animation
|
|
|
// instance_create_layer(_target.x, _target.y, "FX", oFx_Marked);
|
|
// instance_create_layer(_target.x, _target.y, "FX", oFx_Marked);
|
|
|
}
|
|
}
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
}
|
|
}
|