Page 1 of 1

Snake game with mouse control

Posted: September 23rd, 2017, 8:54 pm
by aslanbey0158
i want to control snek with mouse. For this reason i must change some int to float.
Where can i do?

Re: Snake game with mouse control

Posted: September 24th, 2017, 12:45 am
by Yumtard
I don't quite understand what problem you're having.

But you could prob just typecast to int for the mouse position.

like
Int x = int(wnd.mouse.GetPosX());

Re: Snake game with mouse control

Posted: September 24th, 2017, 6:16 am
by chili
Yumtard wrote:I don't quite understand what problem you're having.

But you could prob just typecast to int for the mouse position.

like
Int x = int(wnd.mouse.GetPosX());
I think he wants to convert from int to float :)

Not sure why you would want to convert the mouse coords into float in the first place... Just use the int output from GetPosX(). Snek is not really a 'floaty' game to begin with.

Re: Snake game with mouse control

Posted: September 24th, 2017, 7:40 am
by albinopapa
I think he wants to modify it so it makes smooth movement, like slither.io.