• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM PS4/arcade stick controller movement

S

SonicTheHedgehog+123

Guest
I want to add an ps4 controller movement to my game. But I dont know how without lying I did search quiet a few hours on youtube and google but this place is the best for an answer. At the end I must be able to go left and right with player jump and duck. I did try various methods but the inputs dont react.
-target is windows
-I do use a dualshock 4 driver on my pc
Code:
//step event player
hspeed = 0
if keyboard_check(ord("D"))
{
hspeed +=move
image_xscale = 1
}
if keyboard_check(ord("A"))
{
hspeed -=move
image_xscale = -1
}
if jumpbuffer > 0
if bodenbuffer > 0
{
vspeed = -21
jumpbuffer = 0
}

I would be extremly happy if someone has a solution to this
 
S

SonicTheHedgehog+123

Guest
Yes I did check the manuals and I am aware of functions like gp_axislv and so on but the methods I tried didnt work with my controller. I know about deathzones.
But I really dont know how to make this work with my code above. Like going right and left or up and down with my contoller
 
S

SonicTheHedgehog+123

Guest
Here is the contoller code:
Code:
///state_move(device,speed)
var dvc = argument0;
var spd = argument1;
gamepad_set_axis_deadzone(dvc,0.3);
var vaxis = gamepad_axis_value(dvc,gp_axislv);
var haxis = gamepad_axis_value(dvc,gp_axislh);
direction = point_direction(0,0,haxis,vaxis);
if (vaxis == 0 && haxis = 0)
{
motion_set(direction,0)
}
else
{
motion_set(direction,spd);
}
 
What value does dvc get? Are you scanning for controllers to see which slot the PS4 controller resides in?

You also don't need to constantly set the deadzone. Just run it once at the start of your game.
 

Joe Ellis

Member
I test with a usb plug in xbox 360 controller and it works fine using gamepad_axis_value.

Are you getting any response at all from the controller? cus there could be something wrong with it or your pc connecting with it
 
Top