slicky-grease
Member
I programmed an endless runner boss battle and I got everything almost working. The only issue I have is the player is in the idle position. What I want to happen is when the player is on the tiles, he should be in the running state. What I am going for is something similar to the boss fight in Studiopolis Zone(Act 1) from Sonic Mania.
This is the collision my ground object uses.
GML:
function scr_newflarecontrollerinput(){
//Player Input
key_right = keyboard_check(vk_right);
key_left = keyboard_check(vk_left);
key_up = keyboard_check(vk_up);
key_down = keyboard_check(vk_down);
key_jump = gamepad_button_check_pressed(0,gp_face1) + keyboard_check_pressed(vk_space);
key_shoot = gamepad_button_check(0,gp_face3) + keyboard_check(vk_control);
key_lock = gamepad_button_check(0,gp_shoulderl) + keyboard_check(ord("Z"))
key_dodge = gamepad_button_check_pressed(0,gp_face4)
//GamePad Controllers
if (abs(gamepad_axis_value(0,gp_axislh)) > 0.2)
{
key_left = abs(min(gamepad_axis_value(0,gp_axislh),0));
key_right = max(gamepad_axis_value(0,gp_axislh),0);
}
var move = key_right - key_left
if move != 0 && flare != flare.dodge && flare != flare.lock && flare != flare.hurt
{
hsp += move * accel;
hsp = clamp(hsp,-walkspd,walkspd);
}
else
{
//Decel
if hsp > 0
{hsp = max(0, hsp - decel)}
if hsp < 0
{hsp = min(0, hsp + decel)}
}
vsp = vsp + grv;
//Direction with Analong Stick
dir = point_direction(0, 0, gamepad_axis_value(0,gp_axislh), gamepad_axis_value(0,gp_axislv))
}
GML:
function scr_newflareidle(){
scr_newflarecontrollerinput()
if hsp > 0 || hsp < 0 && dodge = false
{
move = 1
sprite_index = spr_flarerun
image_speed = 1
flare = flare.move
}
if place_meeting(x, y+1, obj_wall) && (key_jump)
{
vsp = -jumpspeed
ground = false
sprite_index = spr_flarejump
flare = flare.jump
}
if (key_dodge)
{
move = 0
hsp = 0
flash = 3
key_jump = 0
dodge = true;
sprite_index = spr_flaredodge
flare = flare.dodge
}
if (key_lock)
{
move = 0
key_left = 0
key_right = 0
hsp = 0
key_jump = 0
flare = flare.lock
}
}
This is the collision my ground object uses.
GML:
function scr_collision(){
//Hornizontal Collinsion
if (place_meeting(x + hsp,y,obj_wall))
{
while( !place_meeting(x + sign(hsp),y, obj_wall))
{
x = x + sign(hsp);
}
hsp = 0
}
if x + hsp < view_x
{
while x+sign(hsp) >= view_x
{
x += sign(hsp)
}
hsp = 0
}
x = x + hsp;
//Vertical Collinsion
if (place_meeting(x ,y + vsp ,obj_wall))
{
while( !place_meeting(x ,y + sign(vsp), obj_wall))
{
y = y + sign(vsp);
}
vsp = 0
}
y = y + vsp;
}