Objects in GameMaker can call a create event when they are instantiated. In this video we show how the create event can be used to declare and initialize variables.
- [Instructor] To get started adding functionality…to our ball, we'll open up the ball object…and we'll add a new event, a create event.…From the Control tab we'll add an execute code action…and we'll maximize this window.…We'll give it a three slash comment…saying Initialize Variables.…But before we get to our variables,…we'll need to call a built in…GameMaker function named randomize.…What this function does is reset the seed value…for our game engine's random number generator.…
Without this, any random number we try to use…would be the same each time we ran our game.…And now we can create our variables…starting with ballLaunched…which we'll st to false by default.…We'll also create a lastSpeed variable…and set it equal to 10.…When we launch our ball, we'll want to…make sure it's positioned within…the left and right bounds of the room.…We'll use two variables to track this.…The first is startMinX for the left side.…And we'll set it equal to 4 + sprite_width.…
Four because that's the width of our walls,…and sprite_ width is a built in variable…
- Creating a new GameMaker project
- Creating sprites
- Importing existing images
- Adding collisions
- Playing sounds
- Designing game levels
- Creating start and game over screens
- Exporting the game
Skill Level Beginner
iOS Game Development with Swift 3 and SpriteKitwith Todd Perkins2h 52m Intermediate
1. Getting Started
2. The Game Pieces
3. The Gameplay
4. The Game Cycle
5. Finishing a Project
- 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.