Jump to content
A 2021 backup has been restored. Forums are closed and work in progress. Join our Discord server for more updates! ×
SoaH City Message Board

Mega man style walljump


Recommended Posts

Im using Full engine some one posted...if im not mistaken its sonic fgx.

Here is my code in collision with the terrain / wall parrent

KEY_A= keyboard_check_pressed(ord('Z'))
KEY_RIGHT= keyboard_check_pressed(vk_right)
KEY_LEFT= keyboard_check_pressed(vk_left)


if KEY_LEFT or KEY_RIGHT && KEY_A && !ground
{wallj=1}
else
{exit;}

if wallj=1
{action=16}
else
{exit;}

if action==16 && KEY_A && xdir=1
{hsp=xdir+5 vsp=xdir+5}

if action=16 && KEY_A && xdir=-1
{hsp=xdir-5 vsp=xdir-5}
[/CODE]

My problem is it dosnt do anything. here is a lil something extra in step event,

[CODE]
if ground
{wallj=false}[/CODE]

the "ground" var means if he is standing on ground not touching an object.

I put this in create..not sure if this matters

[CODE]
wallj=0[/CODE]

Also, how do i make it where it checks if its walljumping before air attack/ homing attack, if that is my problem. here is my homing / air attack code,

[CODE]//Homing attack (check animations for drawing sprites)
if action=1 or action=7
{
if KEY_A && delay=0
{
action=5 //Play homing sound below action=5

if instance_number(enemy_basic)>0 && distance_to_object(enemy_basic) <150
//Check if there are enemies first
{
if distance_to_object(enemy_basic)<150 && enemy.y>=y //Locked on (enemy must be in-line or below Sonic, not above)
{lock=1}
else
{vsp=0 hsp+=xdir*6 lock=0} //If not near an enemy, just go foward
}
else
{vsp=0 hsp+=xdir*6 lock=0} //If there are no enemies, just go foward
}
}

//Lock on to nearest enemy (Notice I switch from Damizean's hsp,vsp function to speed and direction then back)
if instance_number(enemy_basic)>0
{
if lock=1 && distance_to_object(enemy_basic)<150 //Go towards enemy
{direction=point_direction(x,y,enemy.x,enemy.y) speed=12 hsp=0 vsp=0}
else
if lock=1 && speed>0 //Cancel lock (too far away from enemies)
{lock=0 hsp=hspeed vsp=vspeed speed=0}
}
else
if lock=1 && speed>0 //Cancel lock (If no enemies are present)
{lock=0 hsp=hspeed vsp=vspeed speed=0}

//If there is a wall between you and an enemy, stop homing attack (also applies to layers)
if instance_number(enemy_basic)>0
{
if collision_line(x,y,enemy.x,enemy.y,obj_walls,1,1) && lock=1
{vsp=0 hsp+=xdir*6 lock=0 speed=0}
else
if collision_line(x,y,enemy.x,enemy.y,obj_hlayer,1,1) && lock=1 && layer=0
{vsp=0 hsp+=xdir*6 lock=0 speed=0}
else
if collision_line(x,y,enemy.x,enemy.y,obj_llayer,1,1) && lock=1 && layer=1
{vsp=0 hsp+=xdir*6 lock=0 speed=0}
}

[/CODE]

I dont have an animation code for wall jumping...its not important right now.

Problem:it wont walljump.

Im using Gamemaker 7.0 Pro

I cant for the life of my remember the name of the engine but it has parts of sonic revival...that I added.

Link to comment
Share on other sites

Here is my code in collision with the terrain / wall parrent

Most engines are designed in a "get-out-of-the-wall" kind of way (as opposed to a "stick-to-the-wall" kinda way) such that collision with the terrain are minimal and extremely brief. There's a high probability that the collision with terrain/wall parent event literally never happens. What you should do is put all this in the Step event inside an if statement which checks for collision with a slightly bigger mask than the collision detection uses (the easiest way to do this is using the function "collision_rectangle").

  • Like 1
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...