Join Joseph Labrecque for an in-depth discussion in this video Timekeeping and detecting game over, part of Adobe Animate CC: HTML5 Canvas and WebGL.
- Someone playing this game could gather…all collectibles without any problem…as we now have things.…Let's push the challenge by adding…a countdown timer to the system.…We'll also employ some end game detection…and provide the ability for the player to play again.…So, opening up our actions panel,…right up top here, we're going to create…a new variable called var gametime.…This is going to be the allowed time in the game.…I'm only going to set it for ten seconds in this example,…so we can see it end rather quickly.…Down in our Tick, so long as the…game is in the playing state,…we want to go and check time to…see if we should end the game or not.…
Let's create that function: checkTime.…And within here, we're going to get the current time.…So we're going to say var ticktime and…set that equal to createjs.Ticker.getTime.…So that's going to get us the current time,…but if you remember, we created that tickstart variable.…So, we want the actual amount of time…from tickstart until now, and to get that…we're going to subtract tickstart from…
This course focuses on using Flash Professional CC to create a shared pool of content for a set of related projects: an HTML5 video, an interactive ad, and a simple web-based game. Author Joseph Labrecque shows how to use Flash's familiar toolset to build and manage assets that fit into a modern web publishing workflow.
- Using code snippets and actions
- Assembling and animating a scene for video
- Rendering the video
- Programming a game in HTML5 Canvas
Skill Level Intermediate
1. Working in HTML5 Canvas and WebGL
2. Animating HTML5 Video
4. Programming a Game in HTML5 Canvas
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.