Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 12-14-2010, 01:55 PM   #1
Miller@KN
Registered User
 
Join Date: Dec 2010
Posts: 1
Default [AS2] Platform game help

I am making a platform style game but my plateform does not work right instead of the charactor having to jump up stairs or on top of a pillar the charactor just automatically bumps to the top of it. Is there some other way to do the script so that the blocks will prevent the charactor from moving through them without it bumping him to the top this is my script so far.

onClipEvent(load){
speed = 15
gravity = 0;
r =_height/2;
jumping = false;
jumpheight = 15;
running = 10
}
onClipEvent (enterFrame){
if(Key.isDown(Key.UP) && !jumping){
gravity = -jumpheight;
jumping = true;
}
if(!_root.ground.hitTest(_x, _y, true)){
gravity++;
_y += gravity;
}else{
jumping = false;
running = false;
gravity = 0;
}
while(_root.ground.hitTest(_x,_y-1 +r, true)){
jumping = false;
_y--;
}
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
play();
_x+= speed;
_xscale = -scale;
} else {

if (Key.isDown(Key.LEFT)) {
play();
_x -= speed;
_xscale = scale;
} else {
stop();
}
}
}
Miller@KN is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 06:47 AM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.