Рет қаралды 415,544
(I am not a game developer, I only know how to do a few codes. My goal is to give novice game developers a start. I wish I had the time to learn coding and I'm sorry if you are mislead by the title. Non the less I teach you how to make a video-game throughout all my tutorials and you will learn how to code minor things. hope you enjoy!) {CLICK SHOW MORE FOR CODES}
these are the codes for the actions-
(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;
}
}
(VCam download link)
www.mediafire.c...
(VCAM Code)
onClipEvent (enterFrame) {
_y += (_root.char._y-_y)/4;
_x += (_root.char._x-_x)/4;
}
(Reset Symbol)
onClipEvent (enterFrame) {
if (_root.char.hitTest(this)) {
_root.char._x = charX
_root.char._y = charY
}
}