• 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!
  • Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Newbie looking for some help with mouse controls

H

hambo245

Guest
Apologies if anyone has already seen me post on reddit but slow replies i figured id try here.

To give some background i'm currently using

offset_x = 100;

if(mouse_check_button(mb_left) and (mouse_x >640)){
phy_position_x = mouse_x + offset_x;
phy_position_y = mouse_y;
}
if(mouse_check_button(mb_left) and (mouse_x <= 640)){
phy_position_x = mouse_x - offset_x;
phy_position_y = mouse_y;
}


to control where my character goes on a 1280 x 720 room. The only issue is this creates a gap of 200 pixels in the centre that cant be used so i was hoping that by maybe incorporating something like (1/mouse_x)*320 as the offset when it hits that 540 to 740 in the x axis 200 pixel dead space it would instead just slowly centre itself the more i approach that 640 middleground. My only problem is i'm not exactly sure how to implement such a thing where it gets the mouse_x position and then uses said formula. Any help is appreciated!

I'm only 2-3 weeks in using this programme with no experience as i picked it up in the humble bundle so apologies (again) if it seems either simple or stupid!
 
K

KerwinSneijders

Guest
After reading this twice, I don't really know what you want, if you want someone to help you, you might just want to explain what you want rather than fixing this, as there might be a simpler way

EDIT: You can use [ CODE] and [ /CODE] to separate code from text (without the spaces):
This is my code:
Code:
///My awesome code!!
EDIT2: After reading it for the third time, isn't all you want to detect where you are going?? (and making your screen follow?
 
Top