Join Joseph Labrecque for an in-depth discussion in this video Scorekeeping and collision detection, part of Flash Professional: HTML5 Canvas and WebGL.
- Now that our collectibles are falling across the screen,…we will want to use collision detection…to determine when they interact with the player instance.…A collision will remove the collectible from play,…and add to the player's score.…We'll also want to display the score…onscreen for the player.…So the first thing we'll do to get this working…is open up our Actions panel,…and directly under tickstart,…let's create a new variable called score,…and we can set that equal to zero initially.…If we go down to our initialization function,…considering that somebody might play this…over and over again,…we want to reset the score whenever that happens…back to zero.…
Down in our collectibles movement function,…I'm going to paste in some code…that's going to do the collision detection for us.…So what's happening here,…is we set a new variable called pt.…pt is set to player.globalToLocal.…GlobalToLocal is going to take certain coordinates…and translate them from a global scope to a local scope,…so that they can be compared effectively…
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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.