Jumping in a 4-directional Shooter

H

HoobleberryPie

Guest
Hello everyone! Currently I am working on a game that will play a bit like Shock Troopers for the NeoGeo. I am trying to figure out a way to implement a jumping ability for the player. Currently my player object has the following variables in it's Create Event:

phy_bullet = true;
hp = 10;
spd = 2.5;
hspd = 20;
vspd = 0;
xaxis = 0;
xlookaxis = 0;
ylookaxis = 0;
yaxis = 0;
len = 0;
dir = 0;
attacked = false;
shootcooldown = 0;

My player object's Density is also set to 0.5.

This is my Step Event for the player object:

depth = -y;
script_execute (state);

// Setting the player sprite based on where it is facing
sprite_index = sprite[face, movement];

// Shooting Bullet Level 1
if (obj_input.shootkey) && (shootcooldown < 1) && (obj_playerstats.level <= 1) {
var p = instance_create_layer(x, y, "layer_bullets", obj_bullet1);
// Bullet cooldown
shootcooldown = 20;
// Bullet speed
var xforce = lengthdir_x(5, face*90);
var yforce = lengthdir_y(5, face*90);
p.creator = id;
with (p) {
physics_apply_impulse(x, y, xforce, yforce);
}
}

// Shooting Bullet Level 2
if (obj_input.shootkey) && (shootcooldown < 1) && (obj_playerstats.level >= 2) {
var p = instance_create_layer(x, y, "layer_bullets", obj_bullet1);
// Bullet cooldown
shootcooldown = 20;
// Bullet speed
var xforce = lengthdir_x(5, face*90);
var yforce = lengthdir_y(5, face*90);
p.creator = id;
with (p) {
physics_apply_impulse(x, y, xforce, yforce);
}
}

// Make the shooting cooldown go back down every frame
shootcooldown -= 1;

// Check for death
if (obj_playerstats.hp <= 0) {
instance_destroy();
}


I've read a few things online about utilizing a Z Axis of sorts. I just don't know how to implement it into my current code. I really don't want to give up on this idea. Any help would be greatly appreciated. Thank you!
 
H

HoobleberryPie

Guest
Do you need to be using physics? You could just use speed function on the bullets. Also use length dir in the direction you want to jump and if you jump, move in that direction. If you want the player to look like they are moving off the ground add a shadow, and scale up the sprite as its jumping. Not sure if this is a system you would want. Hope this helps at all.
Thank you, I'll try it out!
 
Top