Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    Flash




Help With Platform Game



I'm making a platform game, but i'm stuck with coding.

1. i don't know how to make an action for 2 keys:

i want to make when you hit LEFT or RIGHT + CTRL

2. I want to make my character jump by pressing SPACE + LEFT or RIGHT

3. I don't know how to make my hero jump to a higher or lower platform and make it fall when you miss a platform.

Please help me, cause i can't figure it out.

Thanks,

Tha DraX

PS: I'm using flash 4, but i will use flash 5 if it can't be done with flash 4.



FlashKit > Flash Help > Flash ActionScript
Posted on: 08-23-2001, 05:42 PM


View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread

Platform Game....help
ok, im sorta a flash newbie, and the tutorials on this site dont gimme tutorials on how to make a platform game... i've made a dress-up game before so im not a COMPLETE newb, but i need help. if u got a site that teaches u how to i'd be grateful

Help With Platform Game
Hi,
Im making a platform game, and im using the source that I put with this post. My problem is that I want to place the platforms inside a movieclip. But when I do that the hero cant stand on them. Can you tell me what code I should change...?
plz help me..., tnx

Help With Platform Game
Hi,
Im making a platform game, and im using the source that I put with this post. My problem is that I want to place the platforms inside a movieclip. But when I do that the hero cant stand on them. Can you tell me what code I should change...?
plz help me..., tnx

Platform Game
is this the place to post this?
neways,I am new here and is 50-50 when it comes to actionscript and how do i make a game so that when the character(for example mario)mario moves to the side the backround moves to the side with him.i have checked many many places and so i posted here thnx 4 ur time



happy valentines day!!

Platform Game
If anyone knows a good tutorial on making a game like mario or could help me with platforms in a game like mario, that would be great.

Thanks

Platform Game
I need help in the backgrounds of my game, what im trying to do is to scroll the background when the sprite is at half of the screen. Im making a racing game, so i would want to have a scrolling background, so it appears to move as my car moves. Also if anyone knows how to create random cars that would help too. Thanks

Platform Game
Hi, I'm trying to modify a platform game that I found on the web.

Whenever the hero lands on a platform, I want a movieclip to play from my library. So when the hero lands on the first platform a movieclip from the library would play, then when the hero lands on the second platform, a different movieclip would play, and so on.

I've almost got it working for the first platform by using this code on the hero movieclip:

onClipEvent (enterFrame) {
if (this.hitTest(_root.platform)) {
_root.funFactHolder.attachMovie("funFact1","newIns tanceName", _root.getNextHighestDepth());
}
}


But when I use this code, the movieclip "funFact1" only plays when I move the hero off of the platform, I want it to play when the hero first lands on the platform. Then, I'm not sure how to make the second movieclip play when the hero lands on the second platform.

I'm in a real mess here, and I'm not too hot with actionscript.

Can anyone offer me any advice?

Thanks in advance.

Platform Game - Uh, Help.
Hey Everyone,
I've been wrestling with this platform game that I'm trying to get going. I'm stuck yet again.

I have a movieclip that plays when the hero lands on a particular platform. I'm using this code on the platform to detect if the hero lands on it:

onClipEvent (load) {
var shouldPlay:Boolean = true;
}
onClipEvent (enterFrame) {
if (this.hitTest(_root.player)) {
if (shouldPlay) {
_root.holderSixFive.attachMovie("funFactSixFive"," newInstanceName", _root.getNextHighestDepth());
shouldPlay = false;

}
} else {
shouldPlay = true;
}
}


Now, is there a way to make this movieclip stop playing when the hero leaves the platform?

So it only plays while he's standing on it, when he leaves, the movieclip stops, so a person doesn't have to watch the whole movieclip if they want to continue playing the game.

As always, thanks for everyone's help.

Platform Game
how can i make view moves with player? in platform game

Platform Game Help
I took the original game from Kirupa and edited it to be like the Gameboy version of Legend of Zelda as best as I could, but I can't figure out how to make my hero not fall unless I put a hole in the map, and how to make it so that when I would move him up and down the screen follows him instead of just going left to right. Also how to make him move up and down without falling or jumping.
Also, how would I make a score variable that I can edit during the game from pickups and such and can be accessed later on a different frame?

Can someone please help me with those?

Platform Game Help.
i made a little circle guy move with the arrow keys, but i want to incorporate a floor, and gravity so he actually jumps and doesnt just fly, id like to have obstacles for him to jump over as well as platforms to jump to, but for that i need to know how to make him fall , i think i need hit tests, here is my current code, (this is the only code i can actually write so far i am very new to this) could someone please tell me what i need to add and explain how and why.....?

[F8] Platform Game
I'm going crazy!

This is my first attempt at a tile-based platform game, and I've only been at it for a few days now so it looks pretty bad. The thing is, I've been trying to add moving blocks and extra bad guys, but everything keeps going wonky. The bad guys will show up where I want them to, but when they hit a wall going left they stop altogether. And I have moving blocks, but I can't get more to show up without looking all crazy.

Here's the swf
Here's the fla

Any help from anyone who knows what they're doing would be infintely appreciated.

[F8] Platform Game Help?
I was checking out baz_productions tutorial, "Creating a simple Platform game", and used his code to try and make the character I had developed stand on the platforms I had created.

However, I can't figure out how to make his feet designate whether he's on the platform or not. The top of the clip is what's holding on to the platform, which is definitely not what I'm looking for.

Any help? Here's my code:

Code applied to the character:

Code:
onClipEvent (load) {
gravity = 10;
scale = _xscale;
walkSpeed = 6;
maxjump = 6;
}
onClipEvent (enterFrame) {
if (air == true) {
_y += gravity;
state = 3;
}
if (Key.isDown(Key.LEFT) && !_root.leftbound.hitTest(_x, _y, true)) {
_x -= walkSpeed;
_xscale = -scale;
}
if (Key.isDown(Key.RIGHT) && !_root.rightbound.hitTest(_x, _y, true)) {
_x += walkSpeed;
_xscale = scale;
}
if (_root.platforms.hitTest(_x, _y, true)) {
air = false;
} else {
air = true;
}
if (Key.isDown(Key.SPACE) && jump == true) {
_y -= jumpSpeed;
}
if (air == false) {
jump = true;
jumpcount = 0;
jumpSpeed = 22;
}
if (Key.isDown(Key.SPACE)) {
jumpcount += 1;
}
if (jumpcount>maxjump && jumpSpeed>-2) {
jumpSpeed -= 2;
}
if (air == false && !Key.isDown(Key.LEFT) && !Key.isDown(65) && _currentframe<4 or air == false && !Key.isDown(Key.RIGHT) && !Key.isDown(65) && _currentframe<4 or air == false && !Key.isDown(Key.CONTROL) && !Key.isDown(65) && _currentframe<5) {
state = 1;
walkSpeed = 6;
}
if (Key.isDown(Key.LEFT) && air == false && !Key.isDown(65) && _currentframe<4 or Key.isDown(Key.RIGHT) && air == false && !Key.isDown(65) && _currentframe<4) {
state = 2;
walkSpeed = 6;
}
if (Key.isDown(Key.CONTROL) && air == false && !Key.isDown(65) && _currentframe<4) {
state = 4;
walkSpeed = 12;
}
if (!Key.isDown(65)) {
gotoAndStop(state);
}
_root.statetxt = state;
}
onClipEvent (keyUp) {
if (Key.getCode() == 83) {
jump = false;
}
}




And here's the code on the platforms:

Code:
onClipEvent (enterFrame) {
if (_root.deathTrap.hitTest(_x,_y,true)) {
gotoAndStop(deathFrame);
}
}

[F8] Platform Game Help
I'm making a Platform game and I'm having trouble with it.
The character is always in the wrong position at the wrong time. also im not too sure how to make the guy run. I have the running MC in the Game though


Any help would be appreciated

Platform Game - How Do I's
Hi,
Im about to embark on writing some sort of platform game but have run in to a couple of 'issues'.

Im going to build the map up from tiles. Each tile will be either a platform, wall, backgound etc and my main character will need to detect collision with these. There will also be AI baddies that will need to do the same, all these will be shooting each other so the bullets need to detect collisions with all these other objects and walls etc.

So i am just wondering how you do this, short of a big collision detecting routine for each object vs each object which i dont imagine will be too efficient.

Any help or ideas appreciated

Hambo

Platform Game
Hello,
swf.= http://img131.imageshack.us/my.php?image=itworks5rz.swf
use control shift and enter to make him attack
version = MX 2004
I would like = The man to attack with a click of the mouse, not of a puch of control
Problem = I don't know how to do this, and, I cannot find any tutorials on how
Problem 2 = I don't know how to make him continue attacking even if you let go of a button (see this when holding down enter)
Solution = ?


code =


Code:
onClipEvent(load) {
moveSpeed = 10;
scale = _xscale
}
onClipEvent(enterFrame) {
if(Key.isDown(Key.RIGHT)) {
this._x += moveSpeed;
_xscale = scale;
}else if(Key.isDown(Key.LEFT)) {
this._x -= moveSpeed;
_xscale = -scale;
}
}
onClipEvent(enterFrame) {
if(Key.isDown(Key.UP) && !jumping && _root.platform.hitTest(this._x, this._y+35, true)) {
vel_y = 40;
jumping = true;
this.gotoAndStop(3);
}
if(jumping == true) {
vel_y -= 2;
this._y -= vel_y;
}
if(_root.platform.hitTest(this._x, this._y+35, true)) {
vel_y = 0;
jumping = false;
idle = true;
}
if(Key.isDown(Key.RIGHT) && _root.platform.hitTest(this._x, this._y+35, true)) {
this.gotoAndStop(2);
}
if(Key.isDown(Key.LEFT) && _root.platform.hitTest(this._x, this._y+35, true)) {
this.gotoAndStop(2);
}
if(idle == true && !Key.isDown(Key.LEFT) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.CONTROL) && !Key.isDown(Key.SHIFT) && !Key.isDown(Key.ENTER)) {
this.gotoAndStop(1);
time = 0
}
if(Key.isDown(Key.CONTROL) && !Key.isDown(Key.SHIFT) && !Key.isDown(Key.ENTER) && jumping == false) {
time += 0.02
lunge = (40+(-500*time))
if(lunge <= 0) {
lunge = 0;
}
this._x += lunge*(_xscale/100)
this.gotoAndStop(4);
}

if(Key.isDown(Key.SHIFT) && !Key.isDown(Key.CONTROL) && !Key.isDown(Key.ENTER) && jumping == false) {
time += 0.02
lunge = (60+(-500*time))
if(lunge <= 0) {
lunge = 0;
}
this._x += lunge*(_xscale/100)
this.gotoAndStop(5);
}

if(Key.isDown(Key.ENTER) && !Key.isDown(Key.CONTROL) && jumping == false) {
this.gotoAndStop(6);
}

if(Key.isDown(Key.UP) && !Key.isDown(Key.RIGHT) && !Key.isDown(Key.LEFT)){
this.gotoAndStop(3)
}
}
onClipEvent(enterFrame) {
this._y += 16;
if(_root.platform.hitTest(this._x, this._y+1, true)) {
this._y -= 16;
}

}

Can you help?

Platform Game Help
Hello everyone,

I've been around this forum for a while and have learned a lot from here. Nowadays I am creating games - at least trying to develop games with flash. I'm working on a platform game. But I have a problem figuring something out here.. I have made my character move from left to right, jump, gravity is working fine and it does get the ground<>character collision, but as the ground goes up, the character stays on the same _Y height coordination. Let me try to explain what I mean;

The sprite is the ball;
http://project-midori.com/actionscri...ms/example.JPG
The ball's _Y coordination should go up as it walks up the ground..

I've seen an example of someone who made this game succeeding in what I am trying to accomplish for quite some time.. >_<
http://www.newgrounds.com/portal/view/355647

Can anybody please explain me how this could be done, or point me to someone who does know?
I've looked all over Google, but non of the tutorials that I have found so far explain this..

Thanks in advance!

P.S. I tried looking for a Game Section, but couldn't find one, I hope I did not post this in the wrong section, wouldn't want to screw up on my first post.. >_>

Platform Game Help....
Well, I've got this code here for my character. It's instance name is 'circle', though the character itself is animated, that's just to keep it simple.

PHP Code:



onClipEvent (load) {
     fall = false;
     _name = "circle";
     jump = 0;
     speed = 6;
     jumpheight = 11;
     maxfall = -54;
}
onClipEvent (enterFrame) {
     xmin = getBounds(_root).xMin;
     xmax = getBounds(_root).xMax;
     ymin = getBounds(_root).yMin;
     ymax = getBounds(_root).yMax;
     if (Key.isDown(Key.SPACE) && fall == false && jump == undefined) {
          fall = true;
          jump = jumpheight;
     }
     if (jump<>undefined) {
          if (jump>maxfall) {
               jump--;
          }
          _y -= jump;
     }
}
onClipEvent (enterFrame) {
     if (Key.isDown(Key.LEFT)) {
          _x -= speed;
          if(_xscale==100){_xscale=-100;}
     }
     if (Key.isDown(Key.RIGHT)) {
          _x += speed;
          if(_xscale==-100){_xscale=100;}
     }





Now, this makes the character land on a platform and turn around fine, though my characters movie clip is one frame long, and therefore animated within itself(you know, when you double click). And the character keeps walking no matter what button you press(or don't press). So I need a code to make the character stop walking when no buttons are pressed.
Thanks.

PS. The platform code I have is this:

PHP Code:



onClipEvent (load) {
     activated = false;
     down = false;
}
onClipEvent (enterFrame) {
     _root.report.text = Math.round(_root.circle.yMax)+" "+Math.round(yMin);
     xmin = getBounds(_root).xMin;
     xmax = getBounds(_root).xMax;
     ymin = getBounds(_root).yMin;
     ymax = getBounds(_root).yMax;
     if (_root.circle.xMax>xMin && _root.circle.xMin<xMax && _root.circle.yMax<yMin) {
          if (_root.circle.yMax-_root.circle.jump*2>yMin) {
               _root.circle._y = ymin-_root.circle._height/2;
               _root.circle.jump = undefined;
               _root.circle.fall = false;
               activated = true;
          }
     }
     if (Math.round(_root.circle.yMax)>Math.round(yMin)) {
          if (hitTest(_root.circle) && _root.circle.xmax<xmin) {
               _root.circle._x -= _root.circle.speed;
          }
          if (hitTest(_root.circle) && _root.circle.xmin>xmax) {
               _root.circle._x += _root.circle.speed;
          }
          if (hitTest(_root.circle) && _root.circle.ymin>ymax && _root.circle.jump>-1) {
               _root.circle.jump = -1*(_root.circle.jump);
          }
     }
     if (activated == true && not hitTest(_root.circle) && _root.circle.jump == undefined) {
          _root.circle.jump = 0;
          activated = false;
     }
     if (hitTest(_root.circle) && _root.circle.ymax>ymin && _root.circle.jump<>undefined && _root.circle._y<_y) {
          _root.circle._y = ymin-_root.circle._height/2;
          _root.circle.jump = undefined;
          _root.circle.fall = false;
          activated = true;
     }
     if (_root.circle.ymax-_root.circle.jump>ymin && _root.circle.xMin<xMax && _root.circle.xMax>xMin && _root.circle.jump<>undefined && _root.circle._y<_y) {
          _root.circle._y = ymin-_root.circle._height/2;
          _root.circle.jump = undefined;
          _root.circle.fall = false;
          activated = true;
     }





Maybe that can help......

Platform Game
Hello people. I'm trying to build a simple game: a platform (a kind of) and I want my character to move on the terrain which is not completely flat. It has smooth bumps. (something like this http://www.pyramid-games.com/bud/screenshot_01.jpg just to get an idea). Now here is my problem: When the character is on a bump i'd like to see changing his orientation according to the normal at that position.
For instance if he's at the beginning of a hill, he should change his orientation to 40 degrees which turn to 0 as he moves to the top of the hill.
I was almost forgetting that the terrain is just a shape drawn within flash converted to movieclip.

Any help vould be appreciated.

Platform Game
Hi, I have a problem im making an rpg (role playing gAME)
so far all I have made is a chracter who is movable. I would like this character to be able to jump, when i Tried it I couldnt Get HiM baCk DoWn again. any HeLp iS aPpreciated. thanks alot.

Platform Game
hi i m making a platform game, could ya help me out i want a guy to be able to jump when you press up and come back down to the floor or a platform. thnx.

My Platform Game:(
ok in my game i want a code so that when the default enemy (the square)
comes in collision with spiderman, the health bar up at the top width goes down 10.
Someone Please help!!!!!!!!!!!!!!

http://media.putfile.com/spideygame44

Help With Platform Game
Hey, I am in the process of making a platform game and I can't seem to get the wall codes right. I have followed the tutorial that Nathan supplied on here but something isn't right.
Here is the code:
if (dir == "right" && !_root.leftblock.hitTest(this._x+20, this._y, true)) { this._x += speed; _root._x -= speed;} if (dir == "left" && !_root.rightblock.hitTest(this._x-20, this._y, true)) { this._x += speed; _root._x -= speed;} Maybe it is just me and I am doing something wrong, but I would like some help.. Also is there a way to loop the background or make it static so as you move off the screen to the next part of the level you will still see the same background?

Platform Game
ive been trying to do this for ages. im just trying to make a platform game style movement but this code doesnt work :


ActionScript Code:
onClipEvent (enterFrame) { if (_root.falling=true) {  this._y += 10; } if (!this.hitTest(_root.floor_mc)) {  _root.falling = true; } else {  _root.falling = false; }}


it is supposed to stop on the movieclip called floor_mc.
does anyone know why it just falls though the floor

About A Platform Game...
I want to know i you can make lives or a start over button. the script is just SO confusing

Platform Game Help
Ok basically, i've got the pink blob moving around fine. Just mucking around, but i'm now trying to make moving platforms, but as I tweened this platform to move to the right and back, I jumped on the platform, it moved, and hey, the platform left me behind to fall to my doom. Is there any way to make the platform take me with it? Or do I just have to die?

Platform Game
Ok Since I havent done Platform games in like my whole programming time I completly forgot how and understood.

So I commented this code to see if it was right and now I mam checking with you to check with the code.


Code:
onClipEvent (load) {
// Variables for setting velocity Accelartion and Jumping
vel_y = 0;
accel = 4;
jumping = false;
}
onClipEvent (enterFrame) {
// Boundaries Of The Platform
my_bounds = new Object();
my_bounds = this.getBounds(_root);
t_edge = my_bounds.Ymin;
b_edge = my_bounds.Ymax;
if (Key.isDown(Key.RIGHT)) {
this._x = this._x+5;
}
// Move Left
if (Key.isDown(Key.LEFT)) {
this._x = this._x-5;
}
// Jumpin Is allowed
if (gravity eq "on" and platform eq "off" and !jumping) {
this._y = this._y+12;
jumping = true;
}
// Key To Jump
if (Key.isDown(Key.UP) && !jumping) {
platform = "no";
vel_y = 22;
jumping = true;
}
// To Jump Or Not TO Jump(that is the question)
if (jumping == true) {
if (platform eq "on") {
gravity = "on";
vel_y = 0;
jumping = false;
} else {
gravity = "off";
}
vel_y -= accel;
if (vel_y<-12) {
vel_y = -12;
}
this._y -= vel_y;
}
// Settings
platform = "off";
gravity = "on";
// Boundaries In THe Level
if (this._x<=10) {
this._x = 10;
}
}
if I am wrong could you maybe Tell me what it does do then.

Platform Game
Does anyone know the code for how to make an object move another object with the keyboard?
(Example: To make the background move as you move the character with the keyboard). Exactly as in a platform game where you are climbing upwards stepping on graphics?

The character must be able to move up and down, to the left and to the right, but the background can only move up and down.

Also there need to be gravity that makes the character fall down, like a constant force pulling it down if he steps off the platforms.

I am greatful for all the help you can provide.

Big Problem In Platform Game
Ok im doing a platform game, i already have 12 levels.
Each level is a Scene.
As i move from level to level the speed decreases. But if i play one level at a time the speed is correct!!!!!
This is driving me crazy, i´ve tried everything i could imagine, but no solutions...

Please help me!!

Platform Game Platforms
Hello everyone, I have a quick question regarding platforms in platform games. My main char sprite is set up to jump and have no gravity when in collision with a movie clip called "bottom". I figured that i could just put an invisible movie clip over all of my platforms and make their instance names "bottom", but when i export the movie, the sprite only works on the first "bottom" mc i put into the file, and he jumps through all of the rest.

If anyone could help me out with this, I would greatly appreciate it.

Thanks for your time, Darby

Problem With Platform Game
I made a platform game engine and all is good at the start but once you jump on a platform, your feet go into the platform a certain length (mainly half way). The .fla is located at ftp://69.173.228.202/platform game.fla

Please help

Platform Game Problem
I was making a side-scrolling platform game with a character that jumps around and stuff, and I use gravity to make him stand on the platforms, which is easy to do when they are absolutely horizontal, (for collisions) but I wanted to put some angled floors, and then I can't figure out the good code to make the character move up and right(ex.) when he hits a angled floor. Hope you get what I mean. Here is an exemple:
(Probably the angle here could have been less than 45 degrees but...)
(and forget the dots there, its just because if I had put spaces, it would have messed my lines there)
.................................................. ........../----------------
.................................................. ........./........................
-----------------------------------------/..........................

I just would want it to get up and down the slope without making him go inside the floors!

Platform Game Problem
I was making a side-scrolling platform game with a character that jumps around and stuff, and I use gravity to make him stand on the platforms, which is easy to do when they are absolutely horizontal, (for collisions) but I wanted to put some angled floors, and then I can't figure out the good code to make the character move up and right(ex.) when he hits a angled floor. Hope you get what I mean. Here is an exemple:
(Probably the angle here could have been less than 45 degrees but...)
(Forget about the dots here)
.................................................. ......... /----------------
.................................................. ........./
-----------------------------------------/

I just would want it to get up and down the slope without making him go inside the floors!

Simple Platform Game Help
Hey guy's i'm having a bash at creating a simple side scrolling platform game, and i would really appreciate some help.

I have one platform mc called 'gound' and my sprite can walk on it and fall off!
Heres the code for the first platform which is attached to the sprite mc..


Code:
onClipEvent (enterFrame) {
if (!_root.ground.hitTest(this._x, this._y, true) && !jumping) {
this._y += 6;
jump = 0;
jumping = true;
}
if (_root.dead) {
this.gotoAndStop("dead");
I'm just slightly lost how to create another platform 'ground2' for the sprite to jump onto.

thanks again

Simple Platform Game
I'm not too hot with actionscript, so please bear with me.

I took a Simple Platform Game that I found and I'm trying to modify it. I want the main character (instance name: player) to play a movieclip from my library when it hits a particular platform (instance name: platform).

I have these actions on player right now:

onClipEvent (enterFrame) {
if (this.hitTest(_root.platform)) {
_root.result = "Hit!";
} else {
_root.result = "Miss";
}
}


So, instead of having it display the words "hit" or "miss" in the result field, I would like it to play a movieclip from my library on the main timeline.

Can this be done? Any help would be much appreciated.

Help With Platform Game Actionscript
I'm a newbie with actionscipt so sorry if the problem is really simple. I'm working on a platform game (Like super mario) and I have a hero, "man" and a platform. You can move left and right with the arrow keys and jump with the up arrow. My problem is that when I jump, my hero keeps on falling past the platform beacuse the hitTest doesn't seem to be working.

Code in frame, it is filled with functions that the mc calls:


Code:
stop();
function initGame() {
speed = 5;
bounce = 5;
JumpMax = 10;
JumpSpeed = 0;
flight = 0;
}
//-------------------------------------------------------|
//Movement-----------------------------------------------|
//-------------------------------------------------------|
function moveMan() {
if (Key.isDown(Key.RIGHT)) {
man._x = man._x+speed;
man.gotoAndStop("moveright");
} else if (Key.isDown(Key.LEFT)) {
man._x = man._x-speed;
man.gotoAndStop("moveleft");
} else if (Key.isDown(Key.UP)) {
if (flight == 0) {
flight = 1;
JumpSpeed = JumpMax;
}
} else {
man.gotoAndStop("normal");
}
if (flight == 1) {
man._y = man._y-JumpSpeed;
if (JumpSpeed>(0-20)) {
JumpSpeed = JumpSpeed-1;
}
}
//-------------------------------------------------------|
//Boundries----------------------------------------------|
//-------------------------------------------------------|
if (man.hitTest(north)) {
man._y = man._y+bounce;
speed = 0;
JumpSpeed = 0;
} else if (man.hitTest(south)) {
man._y = man._y-bounce;
speed = 0;
JumpSpeed = 0;
} else if (man.hitTest(west)) {
man._x = man._x+bounce;
speed = 0;
JumpSpeed = 0;
} else if (man.hitTest(east)) {
man._x = man._x-bounce;
speed = 0;
JumpSpeed = 0;
}
}
speed is the speed for moving left and right, JumpSpeed is for jumping. flight is either 0 or 1, it tells whether the character is jumping at the moment or not.

This is in the platform MC:


Code:
onClipEvent (enterFrame) {
if (flight == 1) {
if (me.hitTest(man._x, man._y, true)) {
flight = 0;
JumpSpeed = 0;
man._y = me._y;
}
}
}
Do you see any problems?

Thanks,
Eastwinn

PS: I'm running on Flash MX Pro 2004

[Flash MX] Platform Game
One of you flash genius's please add this code:

onClipEvent (enterFrame) {
if (this.hitTest(_root.block)) {

this.stop();

To the below script, so that it works. It's a game character, and it's meant to make it stop when it hits the object. (And if there's some way to change it so the char can walk on the object too)
I will be eternally grateful to you.

onClipEvent (load) {
move = 0;
lock = true;
}
onClipEvent (keyDown) {
this.mario.play();
}
onClipEvent (keyUp) {
this.mario.gotoAndStop(1);
}
onClipEvent (enterFrame) {
if (move == 0) {
if (lock) {
this._x += Xstep;
Ystep = 0;
Xstep = 0;
if (Key.isDown(Key.LEFT)) {
Xstep = -10;
Ystep = 0;
this.gotoAndStop("left");
} else if (Key.isDown(Key.RIGHT)) {
Xstep = 10;
Ystep = 0;
this.gotoAndStop("right");
}
}
}
}
onClipEvent (enterFrame) {
render();
}
onClipEvent (enterFrame) {
for (i in _root) {
if (i.substring(0, 4) == "coin") {
if (this.hitTest(_root[i])) {
_root[i].gotoAndStop(2);
_root.score += 1;
}
}
}
}
onClipEvent (enterFrame) {
for (i in _root) {
if (i.substring(0, 0) == "bad") {
if (this.hitTest(_root[i])) {
_root.lives -= 1;
if (_root.lives == 0) {
_root.gotoAndStop(2);
}
}
}
}
}
onClipEvent (enterFrame) {
for (i in _root) {
if (i.substring(0, 4) == "save") {
if (this.hitTest(_root[i])) {
_root[i].gotoAndStop(2);
_root.score += 10;
}
}
}
}

[F8] Ceilings In A Platform Game
So.. here it is:



i'd embed the actual game here but i don't think this forum is letting me. which is strange. you can embed images but not flash? i guess flash can be kinda viral?

but here's the game as it is right now.. very much incomplete.

http://buenothebear.com/flashgame/flashgame.html

umm.. i'm haveing an issue codeing ceilings.

so.. i've got the walls down. they look like this:


Code:
if (Key.isDown(Key.LEFT) && !_root.leftbound.hitTest(_x, _y, true)) {
_x -= walkSpeed;
_xscale = -scale;
}
if (Key.isDown(Key.RIGHT) && !_root.rightbound.hitTest(_x, _y, true)) {
_x += walkSpeed;
_xscale = scale;
}
and i've got platforms alright;


Code:
if (_root.platforms.hitTest(_x, _y, true)) {
air = false;
} else {
air = true;
}
these are both kinda tricky.. like.. they have to be "arranged" placed in the back. which is a seperate "back" than like being the bottom layer in the layers. i don't know.. it's tricky to get them to work but i'm managing.

anyway.. ceilings. i tried a peice of code similar to that of the walls. but it didn't work. i only half understand what's going on in that code.

Any help would be appreciated.

(this is my first time learning flash, i'm involved in a competition with a buddy of mine to see who can learn flash in 3 days and make a game.. so i've been going through a ton of game tutorials and learning the language a bit and makeing a frankenstein platform game out of various half assed game tutorials from this website. Is this the largest flash community around?)

[F8] Help With Scrolling Platform Game
im extremely new to actionscript, and its my first programming language that iv attempted to learn, like a few days ago i started. anyway i want to achieve an effect similar to this, were when you walk right you keep moving right but you get closer to the left and more on the right is seen. and if you walk left you get closer to the right and you see more to the left. im trying to emulate the feel of super metroid. can anyone help?

video example:
http://www.youtube.com/watch?v=hwcLIGLOpqg

here what i have now:
http://img187.imageshack.us/my.php?i...roid101di7.swf

what i have now can just move left and right with arrow keys.

lol this is my first post and i registered in jan 2005 XD
i joined cause the animation forums anyway, not the AS

Platform Game Tutorial
can anyone recommend a good mario type game tutorial like tonypa's old flash 5 ones? i can't seem to find any flash 8-9 compatible tutorials.

pleeeaasee, thanks a lot.

Platform Game Door Help
Could someone tell me why this script isn't working?

This script is on a door, and p1 is the character. When the character goes over the door and presses UP, I want the door to go to its second frame.


Code:
onClipEvent (enterFrame) {
if (this.hitTest(_root.p1)) {
if(Key.isDown(Key.UP)) {
this.gotoAndPlay(2);
}
}
}

[F8] Slopes In Platform Game
I've seen the possibilities of making straitforward platform games in which you only use horizontal platforms. Is there a way to make your character walk on a slope or a curved surface? I can't find anything like that in the tutorials.

Jumping In Platform Game
what is a good way to jump in a platform type game

Scrolling In A Platform Game
Hi I'm playing with mutliple options for letting my game scroll, like using a moving background, moving the player and the root to the opposide direction etc.

Now I was wondering if it were possible to move the root._x to the opposide direction of the player not by moving in the opposide directions with the same number of "steps" the player takes(contra movement), but calculating the position of the root._X relative to the player._x, so the player._x is allways in the middle of the screen. I ask for this becouse I have some tiney bugs in my scripting which I could work around doing this and save me a lot of time (I dont have to much time my school ends in 6 weeks)

Thanks in advance,
GrtZ

Flash Platform Game
Only just starting actionscript and not much of it makes sense to me so I was wondering if someone would send me a FLA file of a BASIC platform game. All it really needs is a couple of platforms and a character who can jump and move with the arrow keys.
Very grateful for any help,
Oscar

Platform Game - Shooting :S
Hi im making a platform game
and ive coded my guy to jump and walk around but im stuck on how to shoot does any1 know how to code it or anygood examples
thanks for any help

Platform Game Engine
I'm attempting to develop a platform game. Simple enough, huh.
But I'm having trouble with the vertical scrolling when you drop down a level. Picture in your mind Mega Man...

If you've never played ANY of the Mega Man games, please move on.

If you can remember, when climbing ladders and whatnot, the vertical scrolling was smooth until you got to a certain point (Let's call them Wily Doors, y'know what I mean), where the scrolling would stop until you came in contact with a certain point, then the screen would scroll automatically to the next area, then control would come back to you until you reached the next point, and so and so forth.

Horizontal Scrolling it working fine, except when I have my character ride on a moving platform, then the scrolling is very jittery. But for vertical scrolling it's a bit harder, (i'm thinking this is due to the gravity variable I have in force).

I'm wondering if anybody knows of a good basic engine that's very easily modified to allow the hero to stay pretty much in the lower center of the screen. but the vertical is fixed until you drop down or climb up a level.

Please do not suggest any tiling process.

Thank You.

Here's the game I have so far. It may take a while to load so please be patient.
CLICK HERE

Platform Game Help Needed
hi I'm making a platform game and I need to know how can I make him move

and play the running animation and so if he was running left it will stop and

he'll be standing left if hes running right it will stop and he'll be standing right

please help

Platform Game With Hills
I want to make a platformer game like super mario. But I want my game to have hills in it.
There is a very famous flash game called Fancy Pants Adventure 2. It is a platformer with hills in it.
I want to know how to do that. I can make a platformer game using hitTest(); but that only works with boundary boxes and not diagonal and curved objects (like hills). I have looked all over the internet to find out how to do this but I can not find my answer. If you know how to do this then you are absolutely amazing in my eyes and could you please explain to me how to do it.

Thank you































Edited: 02/15/2008 at 11:41:59 PM by rbr1234

Copyright © 2005-08 www.BigResource.com, All rights reserved