I say 1.0.163, "End tghe Game"
#1
Posted 06 November 2011 - 04:47 AM
In HTML, a screenshot is left on an open browser window.
Is there a way to close the browser window as well?
Obviously the player can click/close the tab or the entire browser. But why not have GM HTML5 do it?
#2
Posted 06 November 2011 - 07:53 AM
General practice is that you don't include that option in the game. If they want to close the window, they will close the window.
But if you insist, just make your own extension. There's a few good tutorials around on making the extension, the javascript code you want is window.close().
#3
Posted 06 November 2011 - 03:04 PM
Go to some flash portals, do what virtualy every flash games does; restart the game.
#4
Posted 07 November 2011 - 04:35 AM
That's good! I'll go with restarting the game.HTML5 games should absolutely never "game_end()".
Go to some flash portals, do what virtualy every flash games does; restart the game.
Sheesh, I fat fingered "tghe"! Sorry about that.
Can't blame it on the winter glove because I had to take it off to use the touch screen keyboard.
#5
Posted 07 November 2011 - 08:24 AM
#6
Posted 07 November 2011 - 04:06 PM
End_Game simply stops the code, and is there for compatibility. It should never really be used, as if a user wants to quit, they'll simply change web page to somewhere else. This function is really there to shut down executables where the user can't easily kill the app.
Call this episode, "Stumbling into best practices." I have not delved in Flash or Browser games. GM HTML5 is my intro to these things.
Now that I've learned this, I will include it in my lecture notes.
And wouldn't you know it, I just tried to check the documentation and could not pop it up. Oh well! Might I suggest that the documentation say something about how to treat End_Game in HTML? Not that I read it, of course...but sometimes I do...after the fact, of course.
Now I have to figure out how to deal with an End_Game that restarts. The sequence of the learning activity was to have
1. watched a video,
2. work some exercises on paper and/or a game (this is where GM HTML5 comes in), then
3. fire up an evaluation session (a written quiz or a special game challenge)
Later on, I'd like to try using the interactive Smart Board ® for some in class gaming activity.
#7
Posted 07 November 2011 - 04:13 PM
Now I have to figure out how to deal with an End_Game that restarts. The sequence of the learning activity was to have
The simplest way is to just have a room display a menu, something that displays:
- Play Game
- Options
- Instructions
- Credits
Then where you normally would have done an end_game(), just do a room_goto to the room that displays the menu.
#8
Posted 07 November 2011 - 05:45 PM
#9
Posted 07 November 2011 - 05:48 PM
Yes.Ok, everyone in this topic says end_game(), but isn't it game_end()?
#10
Posted 07 November 2011 - 05:50 PM
Ok, everyone in this topic says end_game(), but isn't it game_end()?
Yes, it is game_end();
#11
Posted 08 November 2011 - 06:27 PM
I think you'd have to solve this in a different spot than where the game_end() is, because the problem is not in the command itself, but in the reason why it is executed.Now I have to figure out how to deal with an End_Game that restarts. The sequence of the learning activity was to have
The simplest way is to just have a room display a menu, something that displays:What ever is appropriate for your game.
- Play Game
- Options
- Instructions
- Credits
Then where you normally would have done an end_game(), just do a room_goto to the room that displays the menu.
What you'd normally have, in a Windows game, is a menu with a Quit button. And that's a typical button to call game_end() when pressed. Since such a button makes no sense in an HTML5 environment, you should make sure it doesn't appear, or disappears, in a browser environment. If you want to make your game compatible with both Windows and HTML5, the solution would be to simply remove the Quit button at run time if the game runs in a browser. One could put this in its create event:
if (os_browser!=browser_not_a_browser) instance_destroy();
#12
Posted 08 November 2011 - 09:06 PM
One could put this in its create event:
if (os_browser!=browser_not_a_browser) instance_destroy();
Not familiar with os_browser. Is it an extension?
#13
Posted 08 November 2011 - 09:19 PM
No, it's a new system variable under GM4HTML5 which tells you the type of browser the game is being run in, if any. The check above tells you that it is running in a browser.Not familiar with os_browser. Is it an extension?
Edit: correction.
Edited by Smarty, 08 November 2011 - 09:44 PM.
#14
Posted 09 November 2011 - 03:44 AM
No, it's a new system variable under GM4HTML5 which tells you the type of browser the game is being run in, if any. The check above tells you that it is running in a browser.
Not familiar with os_browser. Is it an extension?
Edit: correction.
Sweet! By looking it up under YoYo Functions, I found the answer to another post I put up on launching with Opera on an Android tablet.
At least now, I can test if it's Opera and if not, then give a nice user friendly prompt to switch browsers or die with "Your browser doesn't support HTML5 canvas."
Thank you!
#15
Posted 09 November 2011 - 06:46 AM
#16
Posted 09 November 2011 - 07:09 AM
It appears he wants to show the "Canvas not supported" message if it is *not* Opera. Not sure why <canvas>Canvas not supported!</canvas> isn't a better catchall solution...But Opera does support HTML5...?
#17
Posted 09 November 2011 - 09:13 AM
Ah, I misread it.It appears he wants to show the "Canvas not supported" message if it is *not* Opera. Not sure why <canvas>Canvas not supported!</canvas> isn't a better catchall solution...
Let alone that to be able to actually display a message using from within the game requires canvas support...
#18
Posted 09 November 2011 - 11:53 AM
Ah, I misread it.
It appears he wants to show the "Canvas not supported" message if it is *not* Opera. Not sure why <canvas>Canvas not supported!</canvas> isn't a better catchall solution...
Let alone that to be able to actually display a message using from within the game requires canvas support...
I have been trying to find a way around "Canvas not supported". I realize it's going to pop up before GM HTML5 jscript launches. Nonetheless, because os_browser is there, I'm hoping to use it.
I tabled the issue of testing for a compatible browser last week. Although, proceeding in other areas of the project, has always been tempered by the lack of a compatibility test/re-route.
#19
Posted 09 November 2011 - 12:07 PM
I think all that's needed is the CSS-fu to make the text show up white and maybe changing the text to something more helpfull. Also is it permissible to include markup between the canvas tags?I have been trying to find a way around "Canvas not supported". I realize it's going to pop up before GM HTML5 jscript launches. Nonetheless, because os_browser is there, I'm hoping to use it.
#20
Posted 09 November 2011 - 12:15 PM
Well, look no further. Simply change the index.html file, because that's where the message is coming from:I have been trying to find a way around "Canvas not supported". I realize it's going to pop up before GM HTML5 jscript launches. Nonetheless, because os_browser is there, I'm hoping to use it.
<canvas id="canvas" width="www" height="hhh"> <p>Your browser doesn't support HTML5 canvas.</p> </canvas>
You could put an alternate text, an image, an animation, a piece of Javascript and what have you in there.
Look, don't bother to worry about that. GM4HTML5 should be taking care to support all HTML5-capable browsers regardless of what's in your game, as long as the game keeps in line with the general limitations of running in a browser. If you sometimes find out that it doesn't, you can report that, because it will need to be fixed - typically a report of the "it works in browser A but not in browser B" kind. That's why the software is in beta, after all. Don't let that take away from your efforts to develop a game.I tabled the issue of testing for a compatible browser last week. Although, proceeding in other areas of the project, has always been tempered by the lack of a compatibility test/re-route.
Eventually, your supported browser list message will be easy:
"HTML5 canvas not supported. Be sure to play this game in the latest versions of Internet Explorer, Chrome, FireFox, Opera or Safari."
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











