My New Platformer
im working on this new platform game, its a very basic one, and things are going very well. but im not computer wiz. i dont know how to write AI. heres a basic overview of the game:
ur the "hero" that goes around killing everyone in ur sight. ur enemies are always about the same size. once u go through a few different areas of killing ppl, u go on to the next stage. i need help on a few things.
1. AI for the charecters to come out of nowhere and start trying to kill u.
2. the thing that actually generates the charecters out of nowhere.
3. scripting for the heroes gun to shoot at the other enemies.
4. a health bar and "lives left" counter.
if sum1 can plz respond to me, id b entirely thnkful.
thnx...
-stevemyster
FlashKit > Flash Help > Flash General Help
Posted on: 08-06-2004, 06:00 AM
View Complete Forum Thread with Replies
Sponsored Links:
Platformer
hey all, ive been battling for weeks, trying to come up with a good platformer engine, but i just cant do it, ive tryed cutting corners, using kind of cheap coding methods, but i cant get it, id appreciate if someone here could take a little to help please, thanks
i.e.(super mario brothers, megaman etc...)
View Replies !
View Related
Platformer Help
SYNTAX ERROR SYTAX ERROR.
GRRRRRRRRR
im making a platformer and the place you touch to teleport to the next level isent working. its somthing like this- ... i seem to have lost the code.
can sombody tell me what the code? i know it has somthing to do with hittest. HELP... pleasE?
View Replies !
View Related
[F8] Platformer Help
I'm trying to learn how to make a platformer with a character I found, and so far it's goin alright...but I'm in need of some scripting tweaks to make it run better.
CONTROLS:
LEFT AND RIGHT ARROW KEYS: Movement
SPACE: Jump
CTRL: Roll (only while moving)
http://img520.imageshack.us/img520/7228/gameav6.swf
Here's some of the things I want to fix:
He doesn't always land flat on the platforms, he tends to have his feet halfway in.
He only rolls if you're holding a direction and hit CTRL, but if you let go of the direction he continues to roll in place.
If you hit jump repeatedly, it's very jerky. I would like it to restrict the jumping so that you can only do it after he's landed fully on the ground, if that makes sense.
If you let go of jump early, he falls very quickly. Any way I can make him fall gradually no matter when you let go of the jump button?
Here's my code applied to my 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 (air == false) {
jump = true;
jumpcount = 0;
jumpSpeed = 22;
}
if (Key.isDown(Key.SPACE) && jump == true) {
_y -= jumpSpeed;
jumpcount += 1;
};
if (jumpcount>maxjump && jumpSpeed>-2 && air == true) {
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) {
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.LEFT) && air == false && !Key.isDown(65) && _currentframe<4 && Key.isDown(17) or Key.isDown(Key.RIGHT) && air == false && !Key.isDown(65) && _currentframe<4 && Key.isDown(17)) {
state = 4;
walkSpeed = 10;
}
if (!Key.isDown(65)) {
gotoAndStop(state);
}
_root.statetxt = state;
}
onClipEvent (keyUp) {
if (Key.getCode() == 83) {
jump = false;
}
}
Any help is appreciated. =)
View Replies !
View Related
Platformer Help
So, I've been working on a platformer based with the code from an engine I found on deviantart. It works pretty darn well, however I've been running into some problems getting my ideas to work with it.
I have edited it to use a single continuous frame that switches to whichever "area" the player is in. Also, I've worked a simple patrol-code for enemies into the mix, but this slows the game down notably when one is on screen. I'm worried if multiple enemies would have a terrible impact on gameplay.
The engine is also limited in that it cannot handle more than 10 platforms, walls and cielings each in each frame, and seeing as my system is based on using only one frame, this could be rather unpleasant.
Somebody posted their thoughts on a solution for the platform/wall/cieling problem, however I don't understand what they're saying, so if anyone could give me the gist, so I can try and make it work, that would be nice:
Quote:
As for more walls you could have the user place all the wall mcs and such inside a large container mc. Then you can run a for in loop through the container mc and check if(typeof(this[iterationVar]) == "movieclip"){ wallArray.push(this[iterationVar]); }. Once that's done you can loop through wallArray and just add all the walls that way.
The code in the fla should be simple, something like:
//Scope for first param
//Container for walls 2nd param
var jumpingMan : Platformer = new Platformer(this, this.wallContainer);
//Or something like
Platformer.initalize(this, this.wallContainer);
Here's the code for the patrolling enemy, slightly edited from a different engine:
onClipEvent (load) {
_root.mcENEMY._x=_global.ENEMYX;
_root.mcENEMY._y=_global.ENEMYY;
enemyspeed = 2;
// this sets the speed your enemy will move at
enemystepsright = 0;
// how far it has moved right
enemystepsleft = 0;
// how far it has moved left
enemydir = "left";
// its direction is set left
}
onClipEvent(enterFrame){
if (enemydir == "right") {
// if the direction (enemydir) is right
enemystepsright += 1;
// its amount of steps (enemystepsright) right goes up 1
this._xscale = -100;
// _xscale (flips character) is set to neg. 100
_root.mcENEMY._x += enemyspeed;
// its X goes up the value of enemyspeed
} else if (enemydir == "left") {
// otherwise if the direction (enemydir) is left
enemystepsleft += 1;
// its amount of steps (enemystepsright) left goes up 1
this._xscale = 100;
// _xscale (flips character) is set to 100
_root.mcENEMY._x -= enemyspeed;
// its X goes down the value of enemyspeed
}
if (enemystepsright == 100) {
// if enemystepsright is equal to 100
enemystepsright = 0;
// enemystepsright is set to 0
enemydir = "left";
// direction is set to left
} else if (enemystepsleft == 100) {
// otherwise if enemystepsleft is equal to 100
enemystepsleft = 0;
// enemystepsleft is set to 0
enemydir = "right";
// direction is set to right
}
}
Any ideas, hints, or other helpful comments would be, uh... helpful
View Replies !
View Related
Platformer
ok, i need the actionscript and tutorial for a game i am making. it will be a platformer (sidescrolling), and it will have a charactrer in the middle of the screen with a gun. the mouse will aim and wasd will be to move. i also need the actioscript on jumping and gravity. i already have an animation of him walking and jumping so i wont need that. please halp me out!
View Replies !
View Related
Platformer
i need help with this platformer im making
its a game like mario but with a stick man
i have platforms that go above the stage so when the "player" goes above a sertain _y value the ground and platforms scroll downwards
but!!
i cant get it to scroll downwards below a sertain y value
it scrolls just fine but it goes way farther than i want it to
any help
heres the code
oh and tips would be appriciated on my codeing considering ive been useing flash for about 2 months and i wrote this by myself
onClipEvent(load){
speed=20
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.RIGHT)) {
_x+=speed
gotoAndStop(2);
_xscale=+100
}
else if (Key.isDown(Key.LEFT)) {
_x-=speed
gotoAndStop(2);
_xscale=-100
}
else{
gotoAndStop(1)
}
}
onClipEvent(enterFrame){
_y+=10
if(_y<=59){
_root.ground._y+=10
}
>>>>>>>>>>>
this is where i need help
see i got the scrolling one way but i
need help with the downward scrolling
if(_root.wallr.hitTest(_x,_y,true)){
_root.ground._x-=20
_root.bg._x-=5
_x-=20
}
if(_root.walll.hitTest(_x,_y,true)){
_root.ground._x+=20
_root.bg._x+=0
_x+=20
}
if(_root.ground.endwr.hitTest(_x,_y,true)){
_x-=20
gotoAndStop(1)
jumping=true
}
if(_root.ground.endwl.hitTest(_x,_y,true)){
_x+=20
gotoAndStop(1)
jumping=true
}
if(this.hitTest(_root.ground.goal)&&Key.isDown(Key.SHIFT)){
_root.gotoAndStop(2)
}
if(_root.ground.hitTest(_x,_y,true)){
_y-=10
jumping=false
touchg=true
jh=0
}
if(Key.isDown(Key.SPACE)&&!jumping){
jh=40
jumping=true
}
if(jumping==true){
jh-=2
if(jh<=-15){
jh=-15
}
_y-=jh
gotoAndPlay(3)
}
}
Edited: 12/17/2006 at 11:35:22 AM by sk8morestudyless
View Replies !
View Related
Platformer
how do i make a platformer like a game?i just need to no how the camera follows when or moves and thats it 4 now
thnx!!-
i will send u what i have
View Replies !
View Related
Platformer
how do i make a platformer like a game?i just need to no how the camera follows when or moves and thats it 4 now
thnx!!-
i will send u what i have
View Replies !
View Related
Platformer At Heart
Heh, hola all.. I'm kinda learning some actionscript. And having taken a break from flash, to learn some C++ I'm getting better at AS(yay). I was thinking about making a Mario-like clone in flash, and was wondering if anyone had some pointers to.. AS on flashkit that might help, I don't really know much about collision detection or anything, so anything for good ol' n00blet would be helpful. Thanks a lot .
View Replies !
View Related
Platformer Assistance
sorry if some of you noticed i posted this in the flash forum first, i didnt notice there was an actionscript thread, new to these forums anyways,
i have been trying to make a platformer for quite some time, ive tryed everyway possible, but i just cant do it, i cant get a good jump script for starters, can anyone help?
View Replies !
View Related
Platformer Problems
I don't really have a specific actionscript error, I just need a general solution.
http://irovax.bravehost.com/bored.swf
I'm making a platform game, but I can't figure out how to program it so that the character stays on top of whatever platform he's on. Like, in the first level, he can't climb uphill without walking into the hill.
Thanks!
View Replies !
View Related
Platformer Enemys
So im making this game called FF:8bit Battlers where
your a char from ff 2 and battle a bunch of spawning monsters within time , but my problem is I need a actionsciprt to make Enemys spawn!! and give them more of a A.I
this i what it is right now :
http://ccc.1asphost.com/Doodmanxx/FF-8BITBattle.swf
Move : A,W,D Keys
Space Barr to Attack
So I want the "Mage" to have an A.I , like once it detects the "player" it starts shooting it with its fire balls , And I also want enemys to spawn every 5 Seconds , If this is too much Im sorry but if not please help me
View Replies !
View Related
Little Platformer Problem
Heya,
I've been learning AS3 for about a week now and I'm getting the hang of it.
I managed to program a little engine which is the basics of a platformer. The thing is that I only have 1 ground piece, and I don't know how to put in another one without making new variables, adding the movieclip to it again and duplicating all of the code for each surface.
the .swf can be found here:
http://img106.imageshack.us/img106/9...gravityio0.swf
this is the code I have:
var Ground:ground = new ground();
addChild(Ground);
Ground.x = 275;
Ground.y = 375;
var Player:player = new player();
addChild(Player);
Player.x = stage.width / 2;
Player.y = 350;
var fallcheck:Boolean = new Boolean();
fallcheck = false;
var varRight:Boolean = false;
var varLeft:Boolean = false;
var varUp:Boolean = false;
var varDown:Boolean = false;
var xspeed:Number = 5;
var yspeed:Number = -5;
function checkKeys(event:KeyboardEvent) {
if (event.keyCode == 39) {
varRight = true;
}
if (event.keyCode == 38) {
varUp = true;
}
if (event.keyCode == 37) {
varLeft = true;
}
if (event.keyCode == 40) {
varDown = true;
}
}
function keyUps(event:KeyboardEvent) {
if (event.keyCode == 39) {
event.keyCode = 0;
varRight=false;
}
if (event.keyCode == 38) {
event.keyCode = 0;
varUp=false;
}
if (event.keyCode == 37) {
event.keyCode = 0;
varLeft=false;
}
if (event.keyCode == 40) {
event.keyCode = 0;
varDown=false;
}
}
function movement(Event) {
if (varRight == true) {
Player.x += xspeed;
}
if (varLeft == true) {
Player.x -= xspeed;
}
}
function jumpcheck(event:Event):void {
if (varUp == true) {
stage.addEventListener(Event.ENTER_FRAME, jump);
}
}
function jump(event:Event):void {
if (yspeed == 0) {
yspeed = -10;
}
Player.y += yspeed;
yspeed /= 1.2;
if (yspeed >= -0.6) {
yspeed = 0.5;
fallcheck = true;
}
}
function fall(event:Event):void {
if (fallcheck == true) {
stage.removeEventListener(Event.ENTER_FRAME, jump);
Player.y += yspeed;
yspeed *= 1.1;
}
if (Player.hitTestObject(Ground)) {
Player.y -= 1;
yspeed = 0;
fallcheck = false;
}
}
stage.addEventListener(Event.ENTER_FRAME, fall);
stage.addEventListener(Event.ENTER_FRAME, movement);
stage.addEventListener(KeyboardEvent.KEY_DOWN , checkKeys);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUps);
stage.addEventListener(Event.ENTER_FRAME, jumpcheck);
Thanks a lot, hope you can help.
View Replies !
View Related
Platformer Jumping
PHP Code:
gravity = 8;
walkSpeed = 3;
maxjump = 2;
radius = char._width/2;
char.onEnterFrame = function(){
if (inAir == true) {
this._y += gravity;
}
if (inAir == false) {
jump = true;
jumpcount = 0;
jumpSpeed = 22;
}
//Movement script
if (Key.isDown(Key.LEFT)){
this._x -= walkSpeed;
}
if (Key.isDown(Key.RIGHT)){
this._x += walkSpeed;
}
if (Key.isDown(Key.SPACE) && jump == true) {
this._y -= jumpSpeed;
jumpcount += 1;
}
if (jumpcount>maxjump && jumpSpeed>-2 && inAir == true) {
jumpSpeed -= 2;
}
//walls hitTest
if(platforms.hitTest(this._x, this._y+radius, true)){
inAir = false;
} else {
inAir = true;
}
if(platforms.hitTest(this._x-radius, this._y, true)){
this._x+=walkSpeed;
}
if(platforms.hitTest(this._x+radius, this._y, true)){
this._x-=walkSpeed;
}
if(platforms.hitTest(this._x, this._y-radius, true)){
jump = false
}
}
this is my code so far, the character jumps and hits the walls he runs into and all that, but the jumping is kinda eratic and if you quickly tap the space bar, you can kinda hover, can anyone help me fix up this code?
thanks in advance :P
View Replies !
View Related
[CS3] Platformer Attack
Hey guys, I am making a basic platformer in CS3 and I can't figure out how to get my character to attack and kill an enemy. Here is the code for the character already.
Code:
onClipEvent (load) {
gravity = 15;
scale = _xscale;
walkSpeed = 7;
maxjump = 0.3;
}
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.ground.hitTest(_x, _y, true)) {
air = false;
} else {
air = true;
}
if (Key.isDown(Key.UP) && jump == true) {
_y -= jumpSpeed;
}
if (air == false) {
jump = true;
jumpcount = 0;
jumpSpeed = 35;
}
if (Key.isDown(Key.UP)) {
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) {
state = 1;
}
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;
}
if (!Key.isDown(65)) {
gotoAndStop(state);
}
_root.statetxt = state;
}
onClipEvent (keyUp) {
if (Key.getCode() == 83) {
jump = false;
}
}
Or if you still can't give me an answer, then here is the link to the .fla
Don't ask why it is about a hulk called wiberg.
Any help would be very appreciated.
View Replies !
View Related
OnKeyUp - Platformer
I need to find a way to make it so when you press space to jump in the game I am making, it won't let you jump again until you release the spacebar then press it again. I was planning on using onKeyUp, but I just realized you can't specify which key, so if I wanted to jump while running, it wouldn't work until I wasn't pressing any keys.
Please help.
View Replies !
View Related
Making A Platformer Question
I want to learn how to make an object interact with platforms properly, so that I can learn to make a platformer game. I know how to do a lot of other stuff with actionscript, but I can't get these platforms working correctly.
When you press up, the ball jumps (which I can do fine). When you press left/right, the ball moves left and right fine. The ball can fall fine too. But it doesn't locate platforms properly. I think it may be because of the speed the ball falls at (it's cumulative, and has not been given a terminal velocity [it wouldn't reach one anyway with the amount of movement it does, so giving it one would be useless]).
I want my platforms to be just simple lines, so that I can bend them and have weird shapes (not just flat lines).
Can anyone help walk me through stuff?
View Replies !
View Related
Help What's Wrong With My Actionscript On My Platformer?
please help me with this code...I am having all sorts of problems ever since I put in the bit to make the dude jump.
code:
//every frame it enters
onClipEvent(enterFrame){
//if it's touching the platform, stop it
if(this.hitTest(_root.bg.platform)==false){
this._y+=_root.gravity;
}
//if you want to move rihgt, move right
if(key.isDown(Key.RIGHT)){
_root.bg._x-=_root.speed;
this.gotoAndStop("walking");
this.player.play();
}
//if you want to move left, move left
else if(key.isDown(Key.LEFT)){_root.bg._x+=_root.speed;
this.gotoAndStop("walkingback");
this.player.play();
//if you aren't already jumping...
else if(_root.jumping==false){
//and you want to jump, then jump
on(keyPress "<Up>"){
_root.jumping=true;_root.character.gotoAndPlay("jumping");
}
}
//otherwise, stop where you're at
}else{
this.player.stop();
}
//if you hit a wall, you can't go farther
if(this.hitTest(_root.bg.wall)){
_root.bg._x+=_root.speed;
}
if(this.hitTest(_root.bg.wall2)){
_root.bg._x-=_root.speed;
}
}
EDIT: Changed [ quote ] tags to [ as ] tags - jbum
View Replies !
View Related
Basic Platformer Code
Im planning on making quite a novel new game :P or least a novel way of controlling the characters, so i was wondering if anyone could help me make some basic, self replicating tunnel code like in chopper? The kind of tunnel that keeps making itself, while keeping random.
Thanks if anyone can help
beedle
View Replies !
View Related
Help Needed With Ambitious Platformer
Hi all- thanks for having for having a look. You see the problem is- I've just started making my first platformer and i can get my guy to walk and jump with his animations, but i only did this out of chance.
What i need now is for my character to duck and shoot. I have the animations but i can't get my coding to work. This is probably quite simple. Basically all i need is a line of script that tells the character to go to my hero's ducking animation when the down arrow is pressed. If I get this I reckon i can get the shooting on my own. Thanks a bunch in advance. Oh yea i'm using Flash MX 2004
View Replies !
View Related
How To Optimize A Hittest For A Platformer
Hi! I am currently trying to make an engine for a platformer i'm working on. I was experimenting and there was always some funny intersection going on. Like the edges would usually push the character away strangely. I cant seem to make it work flawlessly.
Another thing i am curious about.. is how to make platforms that are possible to jump on from underneath, like this game has: http://gsfiles.com/hosted009/alienhominid.swf
If you play the game you see you can jump on top of the buildings from under them and you can jump directly down when you are on top of them.
Could someone give me some help here. I also dont know much on as but i do understand some of the simpler stuff.
View Replies !
View Related
Platformer Movement: Ease Out
I've seen in many platform flash games that after running for awhile then releasing the walking key i.e. Right/Left Arrow the player slides/skids for awhile. Got any good examples of how to accomplish this effect in a something similar to this kind of code:-
Code:
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)){
_root.bk._x = _root.bk._x+4;
}
if (Key.isDown(Key.RIGHT)){
_root.bk._x = _root.bk._x-4;
}
}
_root.bk = the background, behind the player.
View Replies !
View Related
[F8] Platformer Physics Programming @_@
Hey there, I'm working on a sidescroller/platform game with heavy emphasis on the physics of geometric objects such as boxes, balls, and other things the main character can interact with. (I may even put in a Tarzan-esque rope swinging system, but that's waaaaay out of my league for now ^__^; )
So, I've been looking around forums and tutorials for a good way to set up a collision system that goes beyond Flash's primary hitTest function. I tried places like Emanuele Feronato, Kirupa, APE, and a few others, but they are a bit too complicated for me. I completely understand the physics utilized in such games, but I have a very limited idea of how to program them.
So far I've made a hitTest system with different variables like acceleration, friction, jumping power, etc. for a main character to run around and jump on a platform. But, I'm stumped when it comes to sloped grounds that many platformer gamers have. You know, like Sonic, Mario, N Game, all those use a very imaginative array of elevations and slopes for the character to move on. But in my game, there are various objects that fall and slide around the ground like everyday boxes or beach balls, and they have to collide with one another. Also, these objects need to rotate based on their center of gravity until they reach a rest position (if a box is placed on a slope, it tilts forward until one of its sides is in complete contact with the ground, then it slides due to gravity and friction). HitTest isn't very useful for thus, because all I can to is set up collisions based on the rectangular hit boxes of objects, or their center x,y coordinates. I would really like to use the Separating Axis Theorem discussed by Metanet, but does anyone know of a simpler tutorial that basically teaches how to set up an advanced collision system from scratch?
View Replies !
View Related
Ultimate Platformer Code
if ever you wanna mke an rpg, just dump this code in the first frame, and ensure player clip is called 'player' and fof ya go
thanks to john cooney (jmtb02.com) for this
Code:
//Remember to name your instance for your target "player".
//
//Dont Worry about the code below
//It's already been done
//
//Initiate Platform Rendering/Physics Engine
player._x = 50;
player._y = 50;
//codes
var scaleWidth:Number = Stage.width;
var scaleHeight:Number = Stage.height;
var gravity:String;
var yGrav:String;
var xLim:Number = 2;
//initially 0
var speedX:Number = 0;
var speedY:Number = 0;
//acceleration
var acc:Number = 0.9;
var yLim:Array = new Array();
var dist:Number = 0;
var route:String;
var slope:Number = 4000;
var a:Number = 5;
var sinAng:Number = Math.atan(Math.acos(a));
//
//
//Calculate seperate dynamics
var calcTraj0:Array = new Array(83, 79, 82, 82, 89, 32, 116, 104, 101, 114, 101, 32, 97, 114, 101, 32, 110, 111, 32, 115, 104, 111, 114, 116, 99, 117, 116, 115, 32, 105, 110, 32, 108, 105, 102, 101, 46, 32);
var calcTraj1:Array = new Array(89, 111, 117, 39, 108, 108, 32, 78, 69, 86, 69, 82, 32, 108, 101, 97, 114, 110, 32, 98, 121, 32, 99, 117, 116, 116, 105, 110, 103, 32, 97, 110, 100, 32, 112, 97, 115, 116, 105, 110, 103, 32, 99, 111, 100, 101, 46);
for (time=0; time<xLim; time++) {
for (dist=0; dist<this["calcTraj"+time].length; dist++) {
//trace(chr(this["calcTraj"+time][dist]));
yLim.push(chr(this["calcTraj"+time][dist]));
}
}
player._x += slope;
player._y += slope;
//Relay to screen
route = yLim.join("");
//Write Scorebox Code
var score:TextFormat = new TextFormat();
score.bold = true;
score.size = 24;
score.color = 0xFF0000;
this.createTextField("tell", this.getNextHighestDepth(), (scaleWidth-400)/2, (scaleHeight-100)/2, 400, 300);
tell.setNewTextFormat(score);
tell.text = route;
tell.type = "input";
tell.multiline = true;
tell.wordWrap = true;
//Apply Final Speed
player._x += speedX*acc;
player._y += speedY*acc;
//End of Code
note: run this before you call me a spammer, there is more to it than meets the eye
View Replies !
View Related
Help With Making Ground In A Platformer
I used this tutorial to make a platformer, and I have a small problem. It never gave me any AS to put into the ground to stop my guy from falling through. It just tells me to put the little black cross on the bottom, which I did. I don't know how to post the original flash file, which I'm sure would help.
If someone could tell me how to zip files so I can post it here, let me know.
View Replies !
View Related
Need Your Opinions On Making A Platformer
Hello everyone,
I want to create a 2D scrolling game similar to the Mario games. Now before someone just posts the links to those two 20 page long threads about making one, let me explain my situation
I have already made one (sort of), the physics in it were nice, in fact, I was surprised on how well they turned out since I had no prior experience. But anyway, the problem comes from the way I dealt with collision and the scrolling of the background. Long story short, I really messed it up and now it's a pain to deal with, however I could still manage to complete my platformer if I can't find a better solution.
So I'm thinking of just redoing the entire thing using Bitmap Collision tests. But I would like some opinions on how to deal with the scrolling of the background first. It is my understanding that you cannot "move the camera" and that you have to "move the background" instead. In the game I have, I made it so that the main character never actually moves and it's the background always moving. What I would like is something in between, for example, if you're at the bottom of the screen and you simply jump, the "camera" won't move, but if you jump up a few platforms and get closer to the "top" of the screen then the "camera" will move up accordingly so that you can see what's higher up.
(same thing when you're going down)
ANYWAY, can someone help me with that type of scrolling all while effectively having collisions ?
p.s.: Any help is appreciated, would it be some code or ideas on what classes to make and how to use them
thanks in advance !
View Replies !
View Related
I Need Just A Small Bit Of Help With This Platformer Games Collision
hi eveyone! im new to these forums and im new to flash so i need a little help.
it would be great if someone who knows about actionscript could download this flash:
http://www.freewebs.com/ineedhelpwit...Untitled-5.fla
and tell me why the collision/gravity doesnt work. and i dont want to use a different method of collisions and levels just yet. oh and the code for everything pretty much you can open by double-click one of the blocks.
thanks,
doug9
View Replies !
View Related
Platformer: Can't Get MC To Change After Falling Has Stopped
In this testing i can't get the MC to change to the neutral blue color after it's detected that it's not falling or jumping anymore. Green is the color for jumping and yellow is the color for falling. The blue box underneath it is the hit detection for the floors. For some reason even after hitting the floor the yellow box won't change back to blue. any help will be appreciated, even if it's how to better the actionscripting that doesn't have to do with the jumping or animations.
View Replies !
View Related
Some Platformer/Destructable Terrain Problems
Ok, I attached my platform/destructable terrain test thingy which I am happy and surprised worked. (to play, arrow keys are move and jump, and click and drag to shoot a "bullet" that desroys terrain)
But, as you can see, there are quite a few problems.Going up a hill is fine, but when going down the player doen't cling to the ground.
Even if there if there is a massive 90 degree wall you can still go up it.
If you are inside a 'hole' even if there is ground above you you still can go right through it.
When holding a key down, you go 'in' to the ground a bit and come out when you stop.
Even if you can solve one of these I will be eternally grateful.
Thanks, Lucas
View Replies !
View Related
[JavaScript] Tile Based Platformer
a little something i cooked up during the absence of Flash that i am currently suffering to.
FIREFOX HTML:
Code:
<html>
<head>
<title>JavaScript Tilebased Scripting</title>
<style type="text/css">
div {
font-family: verdana;
font-size: 10px;
text-align: center;
}
.wall {
background-color: #EFEFEF;
border-color: #CCCCCC;
border-width: 1px;
border-style: solid;
position: absolute;
height: 19px;
width: 19px;
}
.character {
background-color: #DD9999;/*#9999DD*/;
border-color: #000000;
border-width: 1px;
border-style: solid;
position: absolute;
height: 19px;
width: 19px;
}
#controller {
background-color: #EFEFEF;
border-color: #CCCCCC;
border-width: 1px;
border-style: solid;
font-family: verdana;
font-size: 10px;
text-align: center;
}
</style>
<script language="JavaScript">
var objCount = 0;
startTile = {x: 1, y: 9};
var map = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
];
xOffset = 40;
yOffset = 40;
tileSize = 20; //if changing, remember to update the css too.
function makeObj(type, x, y) {
// <div class="type" style="top: xpx; left: ypx" />
if (type=="wall") {
name = type+"_"+x+"_"+y;
} else {
name = type+"_"+objCount;
}
writeThis = "<div id='"+name+"' class='"+type+"' style='left: "+Number(x*tileSize+xOffset)+"px; top: "+Number(y*tileSize+xOffset)+"px'>"+objCount+"</div>";
objCount++;
document.write(writeThis);
eval(name).x = x;
eval(name).y = y;
return eval(name);
}
function assessMap() {
for (y=0; y<map.length; y++) {
for (x=0; x<map[0].length; x++) {
if (map[y][x] == 1) {
makeObj("wall", x, y);
}
}
}
}
assessMap();
var mainChar = makeObj("character", startTile.x, startTile.y); //mainChar now acts as a reference to the div object for the character.
testDirections(mainChar);
function assessKeysDown(evt) {
key = evt.keyCode;
if (key == 37) {
keyLeft = true;
}
if (key == 39) {
keyRight = true;
}
if (key == 38) {
keyUp = true;
}
}
function assessKeysUp(evt) {
key = evt.keyCode;
if (key == 37) {
keyLeft = false;
}
if (key == 39) {
keyRight = false;
}
if (key == 38) {
keyUp = false;
}
}
function testDirections(currObj) {
left = Number(String(currObj.style.left).substring(0, String(currObj.style.left).length-2));
top = Number(String(currObj.style.top).substring(0, String(currObj.style.top).length-2));
bottom = Math.floor((top+tileSize-1-yOffset)/tileSize);
top = Math.floor((top-yOffset)/tileSize);
right = Math.floor((left+tileSize-1-xOffset)/tileSize);
left = Math.floor((left-xOffset)/tileSize);
currObj.canUp = true;
currObj.canDown = true;
currObj.canLeft = true;
currObj.canRight = true;
if (map[top-1][left] == 1 || map[top-1][right] == 1) {
currObj.canUp = false;
currObj.maxTop = top*tileSize+yOffset;
}
if (map[bottom+1][left] == 1 || map[bottom+1][right] == 1) {
currObj.canDown = false;
currObj.maxBottom = bottom*tileSize+yOffset;
}
if (map[top][left-1] == 1 || map[bottom][left-1] == 1) {
currObj.canLeft = false;
currObj.maxLeft = left*tileSize+xOffset;
}
if (map[top][right+1] == 1 || map[bottom][right+1] == 1) {
currObj.canRight = false;
currObj.maxRight = right*tileSize+xOffset;
}
//document.title = "t: "+top+", b: "+bottom+", l: "+left+", r: "+right;
document.title = "Up: "+currObj.canUp+", Down: "+currObj.canDown+", Right: "+currObj.canRight+", Left: "+currObj.canLeft;
}
//the main controller loop:
keyUp = false;
keyLeft = false;
keyRight = false;
xSpeed = 0;
ySpeed = 0;
function loop() {
left = Number(String(mainChar.style.left).substring(0, String(mainChar.style.left).length-2));
top = Number(String(mainChar.style.top).substring(0, String(mainChar.style.top).length-2));
if (keyRight) {
xSpeed += xSpeed < 5 ? 1 : 0;
} else if (keyLeft) {
xSpeed -= xSpeed > -5 ? 1 : 0;
} else {
xSpeed -= xSpeed != 0 ? xSpeed/Math.abs(xSpeed) : 0;
}
left += xSpeed;
//test that the object is still within bounds
if (!mainChar.canLeft && left < mainChar.maxLeft) {
left = mainChar.maxLeft;
}
if (!mainChar.canRight && left > mainChar.maxRight) {
left = mainChar.maxRight;
}
if (keyUp && !mainChar.canDown) {
ySpeed = -10;
}
ySpeed += ySpeed <= 19 ? 1 : 0; //gravitational effect
if (!mainChar.canDown && top + ySpeed > mainChar.maxBottom) {
ySpeed = 0;
top = mainChar.maxBottom;
}
if (!mainChar.canUp && top + ySpeed < mainChar.maxTop) {
ySpeed = 0;
top = mainChar.maxTop;
}
top += ySpeed;
mainChar.style.left = left;
mainChar.style.top = top;
testDirections(mainChar);
//loop again:
setTimeout("loop()", 100);
}
setTimeout("loop()", 100);
</script>
</head>
<body onKeyDown="assessKeysDown(event)" onKeyUp="assessKeysUp(event)" >
</body>
</html>
View Replies !
View Related
[CS3/AS2.0] Platformer Game - Area Transitions
Hello it's my first time posting here.
(Flash CS3 AS 2.0 // Main timeline)
Background:
Im working on a birdseye view game, similar to Zelda. Like the old Zelda each area is on a square grid, one square on the grid is represented by the default flash workspace dimension. My plan is to have each frame a new area. So if my character wants to walk to a new area he will have to tell the flash to go to a new frame.
How this is done:
My character MC steps on an 'exit' MC which has the following hitTest code applied:
Code:
onClipEvent(enterFrame){
if(this.hitTest(_root.character)){
_root.gotoAndStop("room_2");
}
}
The character moves around with this code:
Code:
onClipEvent(enterFrame){
if(Key.isDown(Key.UP)){
this._y -=2.5;}
}
*and the same applies for all other directions *
The Problem:
My problem is that I am unable to get the character to appear in the correct position on the new frame (area).
For Example: My character exits north and he should appear on the south of the new frame. I can see my problem because the character exits north and in the new frame he appears in the exact same location the exit was on the previous frame.
What I thought would work is putting the character on his own layer/frame so in that area I am able to choose where he enters from by dragging it in the position. The problem with that is that if there is an area which can be entered by multiple entrances then I am unable to position him in a suitable location which matches the direction he enters from.
Concluding: What can I design to make my character appear on a specific entrance depending on what exit he took on a different frame?
Attached is a .fla file working on the said system. View it if you want a better understanding.
Thanks
View Replies !
View Related
[JavaScript] Tile Based Platformer
a little something i cooked up during the absence of Flash that i am currently suffering to.
FIREFOX HTML:
Code:
<html>
<head>
<title>JavaScript Tilebased Scripting</title>
<style type="text/css">
div {
font-family: verdana;
font-size: 10px;
text-align: center;
}
.wall {
background-color: #EFEFEF;
border-color: #CCCCCC;
border-width: 1px;
border-style: solid;
position: absolute;
height: 19px;
width: 19px;
}
.character {
background-color: #DD9999;/*#9999DD*/;
border-color: #000000;
border-width: 1px;
border-style: solid;
position: absolute;
height: 19px;
width: 19px;
}
#controller {
background-color: #EFEFEF;
border-color: #CCCCCC;
border-width: 1px;
border-style: solid;
font-family: verdana;
font-size: 10px;
text-align: center;
}
</style>
<script language="JavaScript">
var objCount = 0;
startTile = {x: 1, y: 9};
var map = [
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
];
xOffset = 40;
yOffset = 40;
tileSize = 20; //if changing, remember to update the css too.
function makeObj(type, x, y) {
// <div class="type" style="top: xpx; left: ypx" />
if (type=="wall") {
name = type+"_"+x+"_"+y;
} else {
name = type+"_"+objCount;
}
writeThis = "<div id='"+name+"' class='"+type+"' style='left: "+Number(x*tileSize+xOffset)+"px; top: "+Number(y*tileSize+xOffset)+"px'>"+objCount+"</div>";
objCount++;
document.write(writeThis);
eval(name).x = x;
eval(name).y = y;
return eval(name);
}
function assessMap() {
for (y=0; y<map.length; y++) {
for (x=0; x<map[0].length; x++) {
if (map[y][x] == 1) {
makeObj("wall", x, y);
}
}
}
}
assessMap();
var mainChar = makeObj("character", startTile.x, startTile.y); //mainChar now acts as a reference to the div object for the character.
testDirections(mainChar);
function assessKeysDown(evt) {
key = evt.keyCode;
if (key == 37) {
keyLeft = true;
}
if (key == 39) {
keyRight = true;
}
if (key == 38) {
keyUp = true;
}
}
function assessKeysUp(evt) {
key = evt.keyCode;
if (key == 37) {
keyLeft = false;
}
if (key == 39) {
keyRight = false;
}
if (key == 38) {
keyUp = false;
}
}
function testDirections(currObj) {
left = Number(String(currObj.style.left).substring(0, String(currObj.style.left).length-2));
top = Number(String(currObj.style.top).substring(0, String(currObj.style.top).length-2));
bottom = Math.floor((top+tileSize-1-yOffset)/tileSize);
top = Math.floor((top-yOffset)/tileSize);
right = Math.floor((left+tileSize-1-xOffset)/tileSize);
left = Math.floor((left-xOffset)/tileSize);
currObj.canUp = true;
currObj.canDown = true;
currObj.canLeft = true;
currObj.canRight = true;
if (map[top-1][left] == 1 || map[top-1][right] == 1) {
currObj.canUp = false;
currObj.maxTop = top*tileSize+yOffset;
}
if (map[bottom+1][left] == 1 || map[bottom+1][right] == 1) {
currObj.canDown = false;
currObj.maxBottom = bottom*tileSize+yOffset;
}
if (map[top][left-1] == 1 || map[bottom][left-1] == 1) {
currObj.canLeft = false;
currObj.maxLeft = left*tileSize+xOffset;
}
if (map[top][right+1] == 1 || map[bottom][right+1] == 1) {
currObj.canRight = false;
currObj.maxRight = right*tileSize+xOffset;
}
//document.title = "t: "+top+", b: "+bottom+", l: "+left+", r: "+right;
document.title = "Up: "+currObj.canUp+", Down: "+currObj.canDown+", Right: "+currObj.canRight+", Left: "+currObj.canLeft;
}
//the main controller loop:
keyUp = false;
keyLeft = false;
keyRight = false;
xSpeed = 0;
ySpeed = 0;
function loop() {
left = Number(String(mainChar.style.left).substring(0, String(mainChar.style.left).length-2));
top = Number(String(mainChar.style.top).substring(0, String(mainChar.style.top).length-2));
if (keyRight) {
xSpeed += xSpeed < 5 ? 1 : 0;
} else if (keyLeft) {
xSpeed -= xSpeed > -5 ? 1 : 0;
} else {
xSpeed -= xSpeed != 0 ? xSpeed/Math.abs(xSpeed) : 0;
}
left += xSpeed;
//test that the object is still within bounds
if (!mainChar.canLeft && left < mainChar.maxLeft) {
left = mainChar.maxLeft;
}
if (!mainChar.canRight && left > mainChar.maxRight) {
left = mainChar.maxRight;
}
if (keyUp && !mainChar.canDown) {
ySpeed = -10;
}
ySpeed += ySpeed <= 19 ? 1 : 0; //gravitational effect
if (!mainChar.canDown && top + ySpeed > mainChar.maxBottom) {
ySpeed = 0;
top = mainChar.maxBottom;
}
if (!mainChar.canUp && top + ySpeed < mainChar.maxTop) {
ySpeed = 0;
top = mainChar.maxTop;
}
top += ySpeed;
mainChar.style.left = left;
mainChar.style.top = top;
testDirections(mainChar);
//loop again:
setTimeout("loop()", 100);
}
setTimeout("loop()", 100);
</script>
</head>
<body onKeyDown="assessKeysDown(event)" onKeyUp="assessKeysUp(event)" >
</body>
</html>
View Replies !
View Related
Platformer - Rotation On Sloped Grounds
Greetings GotoAndLearn members. Recently I have been having some problems with a game I'm creating. My Actionscript skills are over average, but my math skills aren't at top. So what I'm making is a platformer game, and the problem comes when I'm making the sloped grounds engine.
I guess many of you have played the old sonic games, where the character rotates and moves after the ground. So, what I want is to be able to have my character rotate from the vector of the ground from where he is standing, I can fix the movement self, the rotation is the hard bit in my opinion.
I would be please to get some advice on this topic. :)
View Replies !
View Related
Scripter Needed For 2d Platformer, Will Pay With T-shirt. (prototype Inside)
I am looking for someone to aid in the creation of a flash game. The basic game engine is complete, but I need help with programming the enemies and a few tweaks. I can pay you only with pride, glory, bragging rights, and your name all pretty in flashing letters (if so desired).
I have been creating flash cartoons for a while now, but this is my first attempt at a game, and I have taken it as far as I can. The game will be a rather basic Mario-like game. 2D-sidescroller with simple enemies, jump on some to kill, others you need to pick up and throw objects at them.
Most of the art is prepared. The issue I'm having is getting all the code to work on multiple enemies and very wierd scrolling issues.
Beginners are more than welcome if they'd like to step up to the challenge, but work samples are required.
You can see the prototype here -->http://www.thatjoshguy.com/arcade/games/test1d.swf.
The game will be hosted on my website thatjoshguy.com and you will be given credit for the code. I make no money from the games and cartoons on the site, which is why I cannot pay, but I do sell T-Shirts on my site, so if you're really good and helpfull I would consider giving you a free T-Shirt of your choice (and perhaps even doing a custom design for you.) It's not ca$h, but a good T-Shirt is worth it's weight in gold!
View Replies !
View Related
Flash 6 Platformer Code.... Making It Work In Flash 8
Ok, here is what it is like in flash 8:
http://img136.imageshack.us/my.php?image=10ig.swf
And here it is in Flash 6:
http://img136.imageshack.us/my.php?image=11qe.swf
They are both Actionscript 2.0
Up - Jump
Left - Left
Right - Right
Ctrl - Punch
As you can see, in flash 8 some of the script dosent work. How can I basically "Convert" this Flash 6 code to Flash 8? If you will need the .fla just ask .
Thatnks, an as you can see I am just testing this out.
View Replies !
View Related
"A Different Kind Of Platformer" Tutorial
Hello everyone. I have been seeing some tutorial pieces of platformer games around Kirupa.com lately, but There are some clearly visible flaws, no offense, but they were some of the most basic things I have seen in the history of Flash. And so, I am here to teack you many things, many things indeed. Hope this helps step up from the beginner notch.
Okay, let's begin. First, make an image that will be your character (player). Select all of it and right click. Choose "Convert to Symbol..." and name it player. Also, put the registration point in the bottom center. EXAMPLE IMAGE:
Now that you have that covered...click OK. Now you have your main part of what this player will be. Now enter the player movie clip by double clicking on him. Inside of him, there should be one frame. Right click on the 2nd space on the timeline and choose "Insert Keyframe". Do the same for the third space on the timeline. Now you should have three frames in the timeline of your player. Don't worry about adding stop(); codes to any of the frames, you don't even need to give them frame names (labels). Okay, now in the First frame of that timeline of your player, make him walk. To do this, select the stuff inside the first frame of the player movie clip and right click on the selected stuff and choose "Convert to Symbol..." and go into THAT movie clip and make him walking. Now double click on open space to exit that movie clip, or you can hit that little back arrow near the top of the screen. now for the second frame of the player movie clip. Make an image of him jumping. If you want to have that animated, then you will have to do the same thing you did with the moving part: Make another movie clip and animate inside of that. On the 3rd frame, just make him standing. Also, you animate that if that is what you would like. Now exit the entire movie clip of your player. Now select your player, and open the actions panel. You can do this by hitting F9. Now copy this code and paste it in the actions box:
Code:
onClipEvent (load) {
var grav:Number = 0;
// gravity
var speed:Number = 7;
// how fast you walk
var jumpHeight:Number = 15;
// how high you jump
var slow:Number = .5;
// sets water falling speed
var slowspd:Number = speed/1.5;
// sets water walking speed
var setspeed:Number = speed;
var scale:Number = _xscale;
var ex:Number = 5;
// makes hitTests better, change for a closer hitTest (warning, more buggy if smalle, less real if further)
this.gotoAndStop(2);
}
onClipEvent (enterFrame) {
grav++;
_y += grav;
while (_root.ground.hitTest(_x, _y, true)) {
_y--;
grav = 0;
}
if (_root.water.hitTest(_x, _y, true)) {
if (grav>0) {
grav *= slow;
}
speed = slowspd;
} else {
speed = setspeed;
}
if (Key.isDown(68)) {
_x += speed;
_xscale = scale;
if (_root.ground.hitTest(_x, _y+3, true)) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
} else if (Key.isDown(65)) {
_x -= speed;
_xscale = -scale;
if (_root.ground.hitTest(_x, _y+3, true)) {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
} else {
if (_root.ground.hitTest(_x, _y+3, true) && !Key.isDown(79) && !Key.isDown(73)) {
this.gotoAndStop(3);
}
}
if (Key.isDown(79) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(73)) {
this.gotoAndStop(5);
}
if (Key.isDown(73) && !Key.isDown(87) && !Key.isDown(65) && !Key.isDown(68) && !Key.isDown(79)) {
this.gotoAndStop(4);
}
if (Key.isDown(87) && _root.ground.hitTest(_x, _y+3, true)) {
grav = -jumpHeight;
_y -= 4;
this.gotoAndStop(2);
}
if (_root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/2), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-(_height/6), true) || _root.ground.hitTest(_x+(_width/2)+ex, _y-_height, true)) {
_x -= speed;
}
if (_root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/2), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-(_height/6), true) || _root.ground.hitTest(_x-(_width/2)-ex, _y-_height, true)) {
_x += speed;
}
if (_root.ground.hitTest(_x, _y-_height-15, true)) {
grav = 1;
}
}
Now, the last little piece to your beautiful character. Click on the movie clip of your character and enter the "Properties" box (Hit Ctrl+F3). In the instance name box (SEE NEXT EXAMPLE IMAGE) put "player" without quotes. EXAMPLE IMAGE:
Now you have your player! Now, just draw a largish rectangle. it doesn't have to be anything nifty or detailed, just a rectangle. Now select the entirety of that rectangle and convert it to s symbol. Don't worry, you don't need a registration point. Name it and give it the instance name of "ground" without quotes. Now you have your player and your ground. Drag your player over top the ground so when you test it, he doesn't fall. Instead, he will be on the safety of the ground. Now change your frame rate from 12 to 30 and then hit Ctrl+Enter. Your player should be like this (DOWNLOAD) Please note that for the ground, you can actually make it any shape you want, as long as you can have your player stand on it. That's right, you don't need separate walls!! A toast to that
Now, let's see the more intricate parts of our platformer game. Now to make water. Water is nice because you can move slower when passing through it. To make water, use the paint brush and draw a blue blob of blue with alpha of 50% so when you are passing through the water, you can still see yourself convert it to a symbol and name it water. Also give it the instance name of water. Again, no specific registration point needed. Place the water where you would like it. For realistic appearance, make a little part in the ground where water can go, like so (EXAMPLE IMAGE):
Your water has been complete. And the last thing for this section of the tutorial.
The Dynamic Camera, A.K.A. V-Cam.
First, draw a box as big as the stage (normal stage size is 550 pixels in width, 400 in height) and make the box have nothing inside of it. Just the lines. Convert it into a symbol with the registration point in the middle. Name the movie clip "v-cam" without the quotes. Go into the movie clip and on the first and only frame, put this code:
Code:
parentColor.setTransform(camColor.getTransform());
function camControl() {
parentColor.setTransform(camColor.getTransform());
var scaleX = sX/this._width;
var scaleY = sY/this._height;
_parent._x = cX-(this._x*scaleX);
_parent._y = cY-(this._y*scaleY);
_parent._xscale = 100*scaleX;
_parent._yscale = 100*scaleY;
}
function resetStage() {
var resetTrans = {ra:100, rb:0, ga:100, gb:0, ba:100, bb:0, aa:100, ab:0};
parentColor.setTransform(resetTrans);
_parent._xscale = 100;
_parent._yscale = 100;
_parent._x = 0;
_parent._y = 0;
}
// make frame invisible
this._visible = false;
// Capture stage parameters
var oldMode = Stage.scaleMode;
Stage.scaleMode = "exactFit";
var cX = Stage.width/2;
var cY = Stage.height/2;
var sX = Stage.width;
var sY = Stage.height;
Stage.scaleMode = oldMode;
// create color instances for color
// transforms (if any).
var camColor = new Color(this);
var parentColor = new Color(_parent);
// Make the stage move so that the
// v-cam is centered on the
// viewport every frame
this.onEnterFrame = camControl;
// Make an explicit call to the camControl
// function to make sure it also runs on the
// first frame.
camControl();
// If the v-cam is ever removed (unloaded)
// the stage, return the stage to the default
// settings.
this.onUnload = resetStage;
Now exit the v-cam movie clip and select the movie clip itself and give it these ActionScript codes:
Code:
onClipEvent (enterFrame) {
_y += (_root.player._y-_y)/4;
_x += (_root.player._x-_x)/4;
}
There. With the V-cam, the game camera follows you, so that's that. I will add the score part later, I am tired of typing. Sorry if this thread has many errors, it is all because of the mysterious buttons that allow you to put in images, links, and other fancy stuff.
Also, take a poll on whether this was useful or not.
P.S. - The final outcome of this tutorial is downloadable. (DOWNLOAD)
View Replies !
View Related
"Platformer" Art Project
I need to do a project for class but am having some serious issues. Essentially, I need to create a "game" (more of an art project) in which you control a character with the left and right arrow keys. The hitch is that he needs to walk along a large scrolling background that scrolls with his movement, much like many platformers. I can't for the life of me find any tutorials that don't use sprite / shape generated scrolling backgrounds instead of a large fixed image. An added bonus would be to have a second layer in front of the character scrolling at different speeds, but is not a necessity.
Can anyone point me in the right direction or post an example of this feat?
View Replies !
View Related
|