(Template no longer needed)
(Fixing this up.)
|Line 1:||Line 1:|
==the platformer sprite==
To start off,
To start off, the platformer spritethe sprite that and as in the [[Game Projects|game]]. . for the , two variablescalled "" and """for this sprite only" , and add the following script to the sprite:
when gf clicked
when gf clicked
Revision as of 01:09, 5 September 2013
|This article or section is currently undergoing major changes by Turkey3 (talk | contribs). Please avoid largely modifying this page's contents until this template has been removed. (Date?)|
A platformer is a simulation of actual physics that take place in real life. Objects fall, move, slide, jump, and bounce, and a platformer associates those properties into a game in which one controls a character to typically move toward some form of a goal.
Creating the platformer sprite
To start off, it helps to create the platformer sprite: the sprite that one controls and plays as in the game. The appearance of the sprite can affect the gameplay slightly, depending on the angles and size of it. Implementing an animating sprite which switches among costumes of different dimensions can prove difficulties within the project. After designing the artwork for the sprite, create two new variables called "x velocity" and "gravity"; select the option "for this sprite only" in the creation menu. That setting makes the variable only changeable by the sprite it is created within, and is used often in a physics situation because they represent personal properties of an individual sprite. Once the variables are created, add the following script to the sprite:
when gf clicked set [Gravity v] to [insert strength of gravity here] forever if <key [left arrow v] pressed?> set [XVel v] to [-4] end if <key [right arrow v] pressed?> set [XVel v] to  end if <<not <key [left arrow v] pressed?>> and <not <key [right arrow v] pressed?>>> set [XVel v] to  end if <not <touching [ground sprite v]>> change y by (Gravity) end change x by (XVel)
Colors would be involved at this part. Lets say that black is the main color the sprite stands on, red makes the sprite go back to the beginning of the level when it touches it, and touching yellow will bring the sprite to the next level.
However, yellow doesn't have to always be square, and red doesn't always have to be a basic line. They can be any kind of strange shape like yellow (Level goal) can be some line and red (Obstacle) could be something like a circle or square.
Levels can look like this! That's what makes platformers popular on Scratch.
When you're done making all your levels, add the following script to the Player sprite:
when gf clicked forever if <touching color [#FF0000]?> go to x:(-180) y:(-47) end if <touching color [#FFFF00]?> broadcast [New level v] go to x:(-180) y:(-47) end
And add the following scripts to the Levels sprite/background:
when gf clicked switch to costume [Level 1 v]
when I receive [New level v] next costume
Finally, add this script to the Player sprite:
when gf clicked forever if <([costume # v] of [Levels v]) = [insert number of levels here]> hide end
When doing platformers, variables are usually present. These varaibles can range from Lives Left to Deaths or Seconds Survived to Coins Collected. The basic name used in simple platformers for variables is Score. To incorporate variables into your platformer, you can use the following script:
when gf clicked forever if <touching color [#FF0000]?> go to x:(-180) y:(-47) change [Deaths v] by (1) end if <touching color [#FFFF00]?> broadcast [New level v] go to x:(-180) y:(-47) end
And for the broadcast received:
when gf clicked switch to costume [Level 1 v] set [Level v] to  when I receive [New level v] next costume change [Level v] by (1)
or if you want to incorporate Lives
when gf clicked forever if <touching color [#FF0000]?> go to x:(-180) y:(-47) change [Lives v] by (-1) end if <touching color [#FFFF00]?> broadcast [New level v] go to x:(-180) y:(-47) end
Making The Win Background
Last of all, comes the win background. After finishing all the levels in the platformer, something would come up that says something like "You Win!". Put it as the last costume in the sprite/background. It can be some text in a basic white background saying "You win" or the art can be complex.
- Simple You Win.gif
A basic You Win background with just some black text and a white background.