From the course: Adobe Animate CC: HTML5 Canvas and WebGL

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Game setup and initialization

Game setup and initialization

From the course: Adobe Animate CC: HTML5 Canvas and WebGL

Start my 1-month free trial

Game setup and initialization

- Flash Professional treats a canvas target nearly identically to how it does Flash Player. And writing code is no exception to this. The only real difference is that we are using the Actions panel to write JavaScript in place of ActionScript. We'll now use the Actions panel to set up some of the fundamental code within our game. So the first thing I'll need to do is actually create an Actions layer. So we'll create a new layer and call it Actions. With that layer frame selected, we're going to go Window and open up our Actions panel. Now that we're in the Actions panel, we can start writing some code. So let's start declaring some variables for our game. The first one will be player, and we'll set that equal to an empty object. The next one is going to be collectibles. And that's going to be set to an empty array. We'll also declare our gamestage, and set it equal to this. This is going to allow us to always refer to the gamestage itself, instead of using something like this within…

Contents