Job2 Street

Saturday, June 16, 2018

How to make a platform game in flash 8 part 1

How to make a platform game in flash 8 part 1


Published on 22 Jan 2012
HOW TO MAKE A GAME IN FLASH - This is the First part of the PLATFORM GAME DEVELOPMENT TUTORIAL which teaches you how to make a 2D platform game ( also called side scrolling game) in flash 8 , flash cs4, flash cs5 or flash cs6. All the codes for the game are written by using a programming language ActionScript 2 ( AS2 ). In this Video you will learn how to make character and ground for your platform game!
One of the most popular genres of video game is the platform game, which also
poses some very interesting programming and design challenges.
From a programming point of view, if you can program a platform game then you are a good programmer

Code for the character:

onClipEvent (load) {
var ground:MovieClip = _root.ground;
var grav:Number = 0;
var gravity:Number = 2;
var speed:Number = 7;
var maxJump:Number = -12;
var touchingGround:Boolean = false;
}
onClipEvent (enterFrame) {
_y += grav;
grav += gravity;
while (ground.hitTest(_x, _y, true)) {
_y -= gravity;
grav = 0;
}
if (ground.hitTest(_x, _y+5, true)) {
touchingGround = true;
} else {
touchingGround = false;
}
if (Key.isDown(Key.RIGHT)) {
_x += speed;
}
if (Key.isDown(Key.LEFT)) {
_x -= speed;
}
if (Key.isDown(Key.UP) && touchingGround) {
grav = maxJump;
}
if (ground.hitTest(_x+(_width/2), _y-(_height/2), true)) {
_x -= speed;
}
if (ground.hitTest(_x-(_width/2), _y-(_height/2), true)) {
_x += speed;
}
if (ground.hitTest(_x, _y-(height), true)) {
grav = 3;
}
}

UPDATE
Download complete project from github :
https://github.com/AthulDilip/AS2-Pla...

Subscribe for more tutorials

No comments:

Post a Comment

K-Play

kPlaylist - get your music online

The player will show in this paragraph

2 3

IkimFM

speaker music speaker