• 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!

Need help with gamepad/mouse thingy!

D

Doooooli

Guest
So my game requires a gamepad to be played(for now atleast) but I'm working on an inv/shop system, and for that too work I would like to have an "illusional" mouse! So let's say when I press gp_start it should show the inv system (I will fix that later) but then I want it to draw/create an temporary mouse, that I steer with my gp_axis! Now my real question is, how complicated is that? Anyone willing to help? :)


thx
 
R

Rocket35

Guest
I'm not an expert on GML but I'm willing to help
1. Create a new object called obj_gamepad_cursor and assign a sprite to it.
2. Place obj_gamepad_cursor in the room (I usually do this first or I will forget).
3. In the step event insert this code:
Code:
//Left Stick
if(gamepad_axis_value(0,gp_axislv)> 0.4){
            y +=10;
    }
if(gamepad_axis_value(0,gp_axislv)< -0.4){
            y -=10;
    }
if(gamepad_axis_value(0,gp_axislh)> 0.4){
            x +=10;
    }
if(gamepad_axis_value(0,gp_axislh)< -0.4){
            x -=10;
    }
The code above will just simply move the object around the screen.
I don't know how your shop will work so I won't be able to help you with that.
 
D

Doooooli

Guest
I'm not an expert on GML but I'm willing to help
1. Create a new object called obj_gamepad_cursor and assign a sprite to it.
2. Place obj_gamepad_cursor in the room (I usually do this first or I will forget).
3. In the step event insert this code:
Code:
//Left Stick
if(gamepad_axis_value(0,gp_axislv)> 0.4){
            y +=10;
    }
if(gamepad_axis_value(0,gp_axislv)< -0.4){
            y -=10;
    }
if(gamepad_axis_value(0,gp_axislh)> 0.4){
            x +=10;
    }
if(gamepad_axis_value(0,gp_axislh)< -0.4){
            x -=10;
    }
The code above will just simply move the object around the screen.
I don't know how your shop will work so I won't be able to help you with that.
No worries, yea I figured it was something like that :) thx for da help! :D
 
Top