Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Mouse Code that works on PC breaks on HTML5

Author
Message
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 17th Jul 2016 03:42 Edited at: 17th Jul 2016 04:47
The code I use to move the camera is very simple and it works on PC But when loading the game in a webpage, the camera movement becomes very strange. Now I might have a clue as to why but no idea as to how to fix it:

Game Location:
http://wigglevault.com/games/DreamTemple/DreamTemple.html#

So the code I use to control the camera is this:



To be honest I am surpirsed I got away with this in the PC version as it is but I do think I might know where the issue lies. The camera rotation is set from a separate variable. What I do is set the mouse to the center of the game window (using values so a 1280x720 game window I'd set the mouse to 640 x 360) and then when the mouse moves I read it's position and subtract the 640 from X and 360 from Y and the result is used to rotate the camera. So my guess is that the HTML window does not respond to fixed resolution and mouse coordinates. It may look like I have to re-write the camera code but I have not found any examples for App game kit. Only DarkBasic.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th Jul 2016 09:32 Edited at: 17th Jul 2016 09:34
at pc this mouse to the middle was a bad habit, because at windows the mouse stops at the borders and we got no speed, unfortunately the user can't use his os.
print some values at screen, so you can better understand what is going on.
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 17th Jul 2016 15:14
Yeah that's what I did. The values seem to behave differently.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 17th Jul 2016 15:49 Edited at: 17th Jul 2016 16:02
O I think I figured out the cause. The code moves the mouse to the center of the screen with SetRawMousePosition(width/2,height/2) every cycle. But the HTML game doesn't do that for some reason. It doesn't move the mouse to the center.

Checked the documentation and indeed they say this method does not work on all platforms:
https://www.appgamekit.com/documentation/Reference/Input-Raw/SetRawMousePosition.htm

So now I need to figure out the alternative for camera mouse movement.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th Jul 2016 19:28
first thing in mind is a Virtual Joystick, see
AddVirtualJoystick ( index, x, y, size )
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Tobias_Ripper
11
Years of Service
User Offline
Joined: 24th Mar 2013
Location: REPCONN inc.
Posted: 17th Jul 2016 19:49
This isn't a mobile game though. This is a PC Chrome/ Firefox Game.
Eisenstadt Studio: Eisenstadtstudio.com
Composers Page: Milesthatch.net
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 18th Jul 2016 04:41
ok, but you can handle the virtual stick by mouse,keyboard,touch,gamepad.
next thing in mind is just a input zone, similar this virtual stick.
AGK (Steam) V2.0.20 : Windows 10 Pro 64 Bit : AMD (16.3.2) Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)

Login to post a reply

Server time is: 2024-09-29 17:28:22
Your offset time is: 2024-09-29 17:28:22