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




Making A Character Jump



looking for some basic actionscript to make a character jump when you press a button like the control key. it must move the entire movie clip.



FlashKit > Flash Help > Flash General Help
Posted on: 04-04-2005, 02:24 PM


View Complete Forum Thread with Replies

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

[F8] Making A Character Jump?
Hey,
How can I make my character jump for a platform game?
I don't know how to set up a jump with gravity etc.
Can anyone help?
Here is my actionscript for the character MC:


Code:
onClipEvent (load) {
xscale = _xscale;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
_x -= 3;
_xscale = -xscale;
gotoAndStop(2);
}else if (Key.isDown(Key.RIGHT)) {
_x += 3;
_xscale = xscale;
gotoAndStop(2);
}else
gotoAndStop(1);
}
}

Making A Character Jump
i need to make my character jump about 1/3 the stage height (wich is 512 pixels) and slow down at the top of the jump and then speed back up to his original speed of 7.5 when falling down.

i already have the code to play his jumping animation wich is follows


ActionScript Code:
//check if the user has the spacebar pressed
    if (Key.isDown(Key.SPACE)) {
        this.gotoAndStop(3);                                                        // show mm jumping animation
    }



wich is part of the whole


ActionScript Code:
// mega man variable
var mm = megaman;      // refrence the movieclip
var speed = 7.5;                // move the movieclip by

// when called;
function moveMM () {
    // check if the user has the left arrow pressed
    if (Key.isDown (Key.LEFT)) {
        this._xscale = -Math.abs (this._xscale);                    // flip mm
        this._x += -speed;                                // move mm
        this.gotoAndStop(2);                                                        // show mm running animation
    }

    // check if the user has the right arrow pressed
    if (Key.isDown (Key.RIGHT)) {
        this._xscale = Math.abs (this._xscale);     // flip mm
        this._x += speed;                                                // move mm
        this.gotoAndStop(2);                                                        // show mm running animation
    }
    //check if the user has the spacebar pressed
    if (Key.isDown(Key.SPACE)) {
        this.gotoAndStop(3);                                                        // show mm jumping animation
    }
}

// setup flash to listen for the user's keyboard
var myListener:Object = new Object();
myListener.onKeyUp = function () {        // when any key has been released
    mm.onEnterFrame = null;        // disable mm's onEnterFrame
    mm.gotoAndStop(1);                      // display mm's stop state
}
myListener.onKeyDown = function () {        // when any key has been pressed
    mm.onEnterFrame = moveMM;                  // enable mm's onEnterFrame (which keeps calling our moveMM function)
}

// now that our listener is set; initilize it
Key.addListener(myListener);



and help would bve appreciated

Character Movement Making Him Jump
Hiya again,

you may have seen my previous post about arrays, well i'm still learning and have set myself another project which i've got stuck on. I have a character that, walks left and right (on respective key presses) and stops facing the way he is going. My problem i have now is i want him to jump on the up key press. How do i do this ?

Heres my FLA file... perhaps someone can advise me on what to do.

Character movement thingy

Making A Game Character Jump Realistic?
Does anyone know how to make a character jump realistic? I tried for 2 days to look for an answer but everything I tried failed.
There shoud be a sort of Math.sin ecuasion in the code but so far I'm lost.
I'd planned to make the character jump by pressing the UParrow.

Can anyone help me?

Thx. Jurriaan Hos

Having A Character Jump
Would you guys reccomend animating a jumping action in a platformer style game. Or using action script. Would this help out when running hitTest's and other functions to get a charcter to jump onto obstacles.

Character Jump Help
OKay, so im new to this nad im trying to make my guy jump, but all he is doing is floating, can anyone help me out, here is the code for my guy in the MC.


Code:
onClipEvent (load) {
// gravity is what I called g in the tutorial. The
// higher g the harder the ball will fall.
// gravity = 0 can be set, as an experiment, but
// it will in fact create a "zero gravity" effect
// gravity < 0 will create an inverted gravity effect
gravity = 2 ;

// We set the speed of the ball when it is released.
speedx = 0 ;
speedy = 0 ;
}

onClipEvent (enterFrame) {
this._y-=_root.gravity
if (_root.jumping == "yes") {
_root.gravity -=.5

}

// We calculate the increase of speed
// speedx doesn't change
if(_root.fall==true){
speedy = speedy + gravity ;


// We move the ball.
// speed/5 just makes the motion slower
this._x += speedx/5 ;
this._y += speedy/5 ;
}}


onClipEvent (load) {
Jump = false;
Jumpable = true;
JumpCount = 0;
Gravity = 0;
}





onClipEvent (enterFrame) {
_y += Gravity;
//If you havent hit the bottom of the block//
if (_root.ball.hitTest(_x, _y, true)) {
Jumping = false;
Jump = false;
Gravity = 0;
} else {
if (Gravity<16) {
Gravity += 1;
} else {
Gravity = 16;
}
}
if (Key.isDown(Key.RIGHT)) {
if (not (_root.grounds.hitTest(_x+(_width/2), _y-(_height/2), true))) {
_x += 4;
}
}
if (Key.isDown(Key.LEFT)) {
if (not (_root.grounds.hitTest(_x-(_width/2), _y-(_height/2), true))) {
_x -= 4;
}
}
if (Key.isDown(Key.SPACE)) {
if (Jump == false && Jumping == false) {
Jump = true;
Jumping = true;
}
if (Jump) {
Jumping = true;
}
} else {
Jump = false;
}
if (Jumping == true) {
_y -= 8;
}
}

How Do I Get My To Character Jump?
Ok im making a platform game and I can't figure out how to make my character jump. I have searched the internt and have found many tutorials but they are all to complicated. I want to know the easiest way to get my character to jump and also land and fall off a platform.

I am using AS3 and at the moment when the up arrow is pressed the character moves up by 2 but that will be replaced by a jump. Can someone rewrite my code so my character jumps, lands and falls off a platform and also if you could put comments it the code so I can see how the code works.


Here is the code im using at the moment.


Code:
stage.addEventListener(KeyboardEvent.KEY_DOWN,movePlayer);
function movePlayer(event:KeyboardEvent):void {


if (event.keyCode==(Keyboard.RIGHT)) {
player_mc.x += 2;
} else

if (event.keyCode==(Keyboard.LEFT)) {
player_mc.x -= 2;
} else

if (event.keyCode==(Keyboard.UP)) {
player_mc.y -= 2;
} else
}

Cheers,
Gathanderoth

Character Walk Instead Of Jump
I have this character that I want to be able to move on the screen. If You click somewhere on the screen I want the character to move there. Now it just jumps there. How can I make it move in a speed I specified?

Here´s the code sofar:

mouseListener=new Object();
mouseListener.onMouseUp = function(){
_root.gubbe._x=_xmouse;
_root.gubbe._y=_ymouse;
}
Mouse.addListener(mouseListener);

Jump Character Like This (problem)
Hi,

I ve got the following action in a function which controls a character MC


Quote:




if (Key.isDown(Key.RIGHT) && this._x < 975) {

this.gotoAndStop("run");


this._x += intSpeed;
this._xscale = -100; // moving left

} else if (Key.isDown(Key.LEFT) && this._x > 50) {

this.gotoAndStop("run");

this._x -= intSpeed;
this._xscale = 100; // move right

} else {

this.gotoAndStop("idle"); // no keys are pressed

}




But my problem is that I really want the character to jump when the UP arrow is pressed, gotoAndStop("jump") - I dont want to HOLD it down throughout the entire jump - but I want to be able to (while running left and right) jump like forinstance jumping along the path of half a circle?



Ive tried EVERYTHING - but I cant get it to work?

ANY help will appreciated greatly!

Thanks in advance,

Mads

Game Character Jump
I'm using the following to make a game character move about the stage:

var dude:Object = new Object();
dude.onKeyDown = function() {
switch (Key.getCode()) {
case Key.UP :
checkY();
checkDudeScaleSm();
_root.dude_mc._y -= 5;
_root.dude_mc._yscale -= 2;
_root.dude_mc._xscale -= 2;
_global.currentXScale = _root.dude_mc._xscale;
_global.currentYScale = _root.dude_mc._yscale;
break;
case Key.DOWN :
checkY();
checkDudeScaleLg();
_root.dude_mc._y += 5;
_root.dude_mc._yscale += 2;
_root.dude_mc._xscale += 2;
_global.currentXScale = _root.dude_mc._xscale;
_global.currentYScale = _root.dude_mc._yscale;
break;
case Key.RIGHT :
checkX();
_root.dude_mc._x += 5;
break;
case Key.LEFT :
checkX();
_root.dude_mc._x -= 5;
break;
case Key.SPACE :
/*
HELLPPP!!!
*/
break;
}
};
Key.addListener(dude);

In the case Key.SPACE, I'd like to use the spacebar to make the character 'jump' over obstacles. How would I do that?

Thanks in advance.
sleepydad

Can't Make My Character Jump
I am creating a game in flash using spirte sheets of megaman and I have a problem setting up script to make him jump. I am able to have megaman run side to side and also shoot but I can not get him to jump. Here is a sample of my code:

var hspeed = 0;
var vspeed = 0;
var i = 0;
var d = 1;
stance = false;
jumpspeed = -10
gravity = 2
//var ob = _root.megaman;
//var keyPressed = false;
onEnterFrame = function(){
new_y = current_y - jumpspeed
jumpspeed = jumpspeed + gravity

_x = _x + hspeed
_y = _y + vspeed

//trace(_y);

if (Key.isDown(Key.RIGHT) ) {
hspeed = 5;
gotoAndPlay("sr");
shoot_right.gotoAndPlay("s3");
d = 1;
}

if (Key.isDown(Key.LEFT) ) {
hspeed = -5;
gotoAndPlay("sl");
shoot_left.gotoAndPlay("l3");
d = -1;
}

if (!Key.isDown(Key.LEFT) and !Key.isDown(Key.RIGHT)) {
hspeed = 0;
gotoAndStop("init");
shoot_right.gotoAndStop("stance");
}
if (Key.isDown(Key.SPACE) ){
if (!Key.isDown(Key.LEFT) and (!Key.isDown(Key.RIGHT))){
gotoAndPlay("ss");
}
//gotoAndPlay("ss");
_parent.fire();
}

/*if (!Key.isDown(Key.UP) and !stance and (vspeed < 0)) {
vspeed = 0;
}
_x+=hspeed;
_y+=vspeed;

if (_y < 400) {
vspeed++;
} else {
vspeed = 0;
stance = true;
}
if (Key.isDown(Key.UP) and stance) {
stance = false;
vspeed = -13;
gotoAndPlay("jr")
//jump_right.gotoAndPlay("js")
}

if (Key.isDown(Key.UP)){
vspeed = -50;
gotoAndPlay("jr")
jump_right.gotoAndPlay("js")

} else {
vspeed++;
vspeed = 0;
}*/


I have been trying to do two different methods but they do not seem to work. Any suggestions would be nice.

How To Make Flash 4 Character Jump?
Hi All,

how do you make a movieclip character jump in flash 4? any sample code or tutorials?

Thanks, woktoc

Character Jump? Stand Up Without Downwards Registration?
okay how would i make a character jump? would instead of in the when.Key.is.down would i make it the key i wanted to be? please help!

also how would i make the character stand on the box without having his registration point at the bottom at the bottom it makes his controls screwy

cn anyone help?

[help] Character Jump On Mouse Click?
I am busy creating a game that is a cartoon man, I have used this code so that the man will move left and right when you move your mouse
startDrag("man", true, 70, 436, 496, 436);

This works, but then I want to have it so that during the time you are moving left and right you can click the mouse at any time and the man will jump upwards and fall down again...

How do I do this? I tried to do it and it worked, but when you hold the mouse button in then it keeps the man up in the air.

Is there any other way of doing this?
I would appreciate any help?

How To Make Character Jump, Walk, Run In Flash 4?
Hi All,

How do i make a character jump, walk, run, etc. in Flash 4 using the keyboard keys? Any tutorials would be appreciated.

Thanks, woktoc

Making A Jump Help
FLASH MX

I want to make an extreme sport game, I know how to make it so the character can move and go on ground but I can't figure out how to make him go off jumps. What do I need to do?

Making A MC Jump...
i am making a mario type game and i was wondering if someone might be able to explain to me how i can achieve a jumping effect when you press a key such as the control key. i know it can be accomplished by animating it, but is there a way to use actionscript that will move the entire movie clip up to a specified height and then return to its original position? thanks!

Making The Jump: AS2 To AS3
Hey everyone,

I'm sure this has been asked over and over again, but I did a search and didn't come up with anything. I consider myself pretty well versed in AS2 and want to make the jump over to AS3. Lately I've been watching some Lynda.com tutorials and it seems very repetitive to what I already know, with a random new snippet here and there.

Are there any books, cheatsheats, etc... that will help me learn the new aspects of AS3 without going through all the programming basics again?

Thanks a lot!
Mike

Making The Jump From AS2 To AS3
Hi. well I got flash CS4 for christmas, and I have been using flash MX 2004 professional for about 4 years.

What should I look out for? is there a big change in the syntax?

Is it pretty much the exact same thing except with more predefined methods, and added parameters to existing methods?

Making The Actionscripting Jump
Alright, to me it seems like there is a big gap between the basic "Goto", "OnMouseOver,"Play," "Stop," etc, and the more advanced know how of great actionscripting. Many commands in actionscripting are simple to learn and develop into a good site, but others, it seems the only resource we have is to turn to our 'gods of flash' her at flashkit for the answers. This makes for a terribly plagerized look.
My question is, is there a resource (more specific that just flashkit) or an online book (ie, advanced actionscripting for dummies without the PhD)???? If anyone can help, please respond....

JK

Should I post this thread somewhere else??

Making Is Slide, Not Jump
i have a movie clip ... and i want it to do basiscally this

on (rollOver) {
setProperty("_root.menuTab", _y, "300");
}


but I want it to slide to the position instead of jumping to it. how do I achieve this with action script.

Making An Object Jump
I'm just getting into programming with Actionscript (MX 6), and I'm working on a sidescrolling platform game. Unfortunately, I can't seem to find any platform game tutorials online, so I'm pretty much doing it myself, using the O'Reilly ActionScript MX book for reference.

So far I've worked out moving sideways and collision detection, which were both pretty easy. What I need to figure out is how to make my movie clip jump. I have a jumpheight variable set at 50, so I want the Y value to increase gradually until it peaks 50 pixels from where it started, then gradually come back down until it collides with a solid object. But I can't really figure out how to do that. I've got this:

Code:
onClipEvent (enterFrame) {
if (Key.isDown(Key.CONTROL)) {
_y -= [uhh...]
}
}

But I dunno how I work jumping into that. Any ideas?

Having Trouble Making The Jump To AS3?
Hey guys. I like many others out there was having a really hard time making the jump from AS2 to AS3. I've never considered myself a really heavy programmer and so all the new things introduced in AS3 just gave me a headache. The biggest hurdle was I although I've worked with flash since version 4, I've never messed with creating my own classes and suddenly everything has to be a class. It wasn't so much the changing of terminology or technique that held me back, it was having to change the way I thought.

So if this sounds like you, I've started writing some tutorials from this perspective in hopes of helping others make that jump. If you are interested you can check them out here:

http://test1labs.com

Let me know if it helps you out at all because I'm probably more likely to write more articles sooner then later if I know people are actually reading them.

Having Trouble Making The Jump To AS3?
Hey guys. I like many others out there was having a really hard time making the jump from AS2 to AS3. I've never considered myself a really heavy programmer and so all the new things introduced in AS3 just gave me a headache. The biggest hurdle was I although I've worked with flash since version 4, I've never messed with creating my own classes and suddenly everything has to be a class. It wasn't so much the changing of terminology or technique that held me back, it was having to change the way I thought.

So if this sounds like you, I've started writing some tutorials from this perspective in hopes of helping others make that jump. If you are interested you can check them out here:

http://test1labs.com

Let me know if it helps you out at all because I'm probably more likely to write more articles sooner then later if I know people are actually reading them.

Making Web Page Jump Back To The Top.
I have a flash web page which is a catalog w/ dimensions of about 700x1500. You can click on each item in the list and a picture of that item will appear at the top of the page in a designated area. But because the page extends several screens down, I need to make the page "bounce" back up to the top each time you click a item. I've tried a variety of simple Actionscript sequences in the Button Actions, but my grasp of AS is fundamental at best, and I can't figure it out. I have two books on Flash, and can't find suggestions for this in either of them.

Better yet (if I can extend the question a tad) would be if upon PRESSING the button, the page jumps up to the top (where the information/picture box is), and upon RELEASE, it returns to its original location down the page.

Thanks to anyone who can help,


K

Making Man Jump And Gun With Calling Different Levels
I am making man walk and jump and pull out a gun by placing in different levels of dot syntax. I got him to jump and to walk. But I cant figure out how to pull out a gun on the second level and I want to contiue go father in levels by calling it up different movemnets for him. Another question which is better to use realtive or Abosulte? How do you write that. My action script is below. Also, It slows down when I play it. How do I make it go smoother.. Is there a better way to write a man to move and do actions. Thanks I have included the FLA file.

on (keyPress "<Left>") {
_x -= 20;
with(dude) {
_root.man.gotoAndPlay("walk");
}
}



on (keyPress "<Right>") {
_x += 20;
with(dude) {
_root.man.gotoAndPlay("walk");
}
}

//Pulls gun out
on (keyPress "<Tab>") {
with(pull_gun)
{
_root.man.dude.gotoAndPlay("gun");
}
}


on (keyPress "<Space>") {
with(dude)//This is the instance name for scene man
{
_root.man.gotoAndPlay("jump");
}
}

Making Icon Jump From One Place To Another
I am creating a file in which there is a dual-monitor set up with one monitor over the other with a small mouse icon that moves when the user drags over a hotspot. When the user toggles a particular switch to the UPPER setting, the mouse icon moves as it would on a normal dual monitor setup where, when moving up, it skips from the top of the lower monitor to the bottom of the upper one.
When the switch is toggled to LOWER, however, the mouse will actually stop in the middle of the 2 monitors (either at the top of the lower or bottom of the upper monitor) depending on which direction it's moving. (see attached image)
So far, I've been able to code the icon to work in the 1st situation. This code is below:

Code:
this.onEnterFrame = function() {
if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
if (monitors_mc[cursor]._xmouse != nowX || monitors_mc[cursor]._ymouse != nowY) {
right = monitors_mc[drag]._x+monitors_mc[drag]._width;
top = monitors_mc[drag]._y;
botOfUpr = monitors_mc[drag]._y + monitors_mc[drag].top_mc._height;
topOfLwr = monitors_mc[drag]._y + monitors_mc[drag]._height - monitors_mc[drag].bottom_mc._height;
//topOfLwr = monitors_mc.drag_mc._y;
//botOfUpr = monitors_mc.drag_mc.top_mc._y+monitors_mc.drag_mc.top_mc._height;
bottom = monitors_mc[drag]._y+monitors_mc[drag]._height;
//
if ((monitors_mc[cursor]._y<bottom && monitors_mc[cursor]._ymouse-nowY>0) || (monitors_mc[cursor]._y-10>monitors_mc[drag]._y && monitors_mc[cursor]._ymouse-nowY<0)) {
monitors_mc[cursor]._y += 0.25*(monitors_mc[cursor]._ymouse-nowY);
}
//
if ((monitors_mc[cursor]._x<right && monitors_mc[cursor]._xmouse-nowX>0) || (monitors_mc[cursor]._x>monitors_mc[drag]._x+8 && monitors_mc[cursor]._xmouse-nowX<0)) {
monitors_mc[cursor]._x += 0.25*(monitors_mc[cursor]._xmouse-nowX);
}
if ((nowY-monitors_mc[cursor]._ymouse) > 0) {
if (monitors_mc[cursor]._y < topOfLwr && inMonitor=="bot") {
monitors_mc[cursor]._y = botOfUpr;
inMonitor = "top"
}
}
if ((nowY-monitors_mc[cursor]._ymouse) < 0) {
if (monitors_mc[cursor]._y > botOfUpr && inMonitor=="top") {
monitors_mc[cursor]._y = topOfLwr;
inMonitor = "bot";
}
}
nowX = monitors_mc[cursor]._xmouse;
nowY = monitors_mc[cursor]._ymouse;
}
}
};
However, I'm not sure how to go about performing the 2nd option. Does anyone have any ideas?

Chris

Making Score Jump To Frame Not Working
Code:
_root.score = _root.score+1;
if (_root.score==250) {
gotoAndStop(61);


Ok well it keep's track fine its just not jumping to the frame.There are no error's or anything.

Making A Character Walk
hey guys, i'm trying to make a small character to walk left and right at the press of a button with actionscript, but so far all i can get to do is make the guy move one way. see, the character is a movie clip and in the MC is two frames, standing,and run. The run frame has an animation of the character running. on the movie clip, i put:

onClipEvent(enterFrame)
{
if(Key.isDown(Key.LEFT))
{
this._xscale = 100;
this.gotoAndStop ("run");
this._x = this._x - 10;
}
else
{
this.gotoAndStop(1);
}
if(Key.isDown(Key.RIGHT))
{
this._xscale = -100
this.gotoAndStop("run");
this._x = this._x + 10;
}
}


now, when i test the movie, the character runs left fine, but when i press right, the character's animation stays on the first frame of "run", but still moves, so it pretty much looks like he's sliding over to the right. also, when i press both left and right, the character's animation is going towards the right, but it isnt moving. if you understand whats wrong with this thing or if you can help me out a little, i'd really appreciate it. thanks.

Making A Smooth Character...
Well what I'm doing is I drew a character and scanned all the parts in. I've got the character together with about 20 layers for everypart of this character.. The problem is I can use mothion tweens and all that but I'm looking to have some things bend in a snake and liquid type matter... I'm not sure the best way to do this. =

-NormanTheDoorman

Making My Character Walk/run
Ok so i designed my character how do i make an animation of it walking/running?

and how do i arrange the process, what layers i need what do i need to save where and etc?

Making Character Move
Hey , i am running Flash MX 6.0 i think. And i wonder. I am gonna make a RPG game , now when i want to create a frame so the character looks like hes moving , how do i do? I mean, you cannot do it on ONE frame only? You will need more frames to make the movie looks like hes moving . Or? Can someone help me with this, please. I've tryed the most, but i see you cannot create only "1" frame so it looks like hes moving? Or can i? If, please tell me how. Thanks!

Making A Character Walk
Im trying to make a character walk in each direction, up down left and right. How do you Play a movie when you press a directional button? LIke if i hit the down key, how do i make it play the WalkDown clip?

Making A Single Character Selected
I want to show the n'th character in a textfield as selected.
Please let me know the implementation.

Making Character Move On Path.
Hi,

I have been trying for a bit to solve this but atm I dont have the skills to come up with an appropriate answer.

Here is the problem:

I have a character that needs to move along a certain path. The path is a basic grid almost like a chess board. Its not a direct line, its not a begin->end path its a more complex walk path. You can move up, down, left right but it has to move along the line.

The map wont always look like that, so the solution has to work between different types of paths (curved, straight etc.)

I completely give up. I hope someone has a good solution.

[MX] Help Making A Character Shoot In Different Directions
Hello everyone, I tried tackling this problem many ways and I can't seem to fix the problem. I have a flash game where pacman can look two ways, he looks right and left.

But the problem is, when he shoots lasers he only shoots right, and I can't make him shoot lasers both ways where the laser keep going and they are removed after when x is 600.

Here is the script on the laser which makes the lasers move:

onClipEvent (load) {
laserMoveSpeed = 20;
this._y = _root.pacman1._y;
this._x = _root.pacman1._x+20;
}
onClipEvent (enterFrame) {
if (this._name<>"laser") {
this._x += laserMoveSpeed;
if (this._x>600 || this._x<0) {
this.removeMovieClip();
}
}
}


Basically I want it so when pacman is looking right, and I find out that using the variable _root.pacman1.pdirection == "+" , and to find out if pacman is looking left is use _root.pacman1.pdirection == "-" .

I tried adding these lines into the script, but what happened is lasers would shoot both ways, but when pacman looked a different way all the lasers would move that way.

So please help me fix this problem, and another one is, that when I'm creating my game sometimes when a object is hitTesting pacman, it also checks hitTest with the lasers when I NEVER write the hitTest for the laser.

I think this happens because I write "this._x = _root.pacman1._x" maybe that adds the lasers to part of the pacman movie clip.So is there an alternative code to complete the same task without making the laser be part of the pacman movie clip?


Please help, this is so hard to fix! The SWF file is uploaded here, arrow keys to move and "Z" to shoot:

http://trickamasters.webs.com/pacman...0getBounds.swf

Thanks!

Making The First Character Of A String Uppercase
Hi guys,

How can I make the first character in a String Uppercase?
For example that "hello world." will be converted to "Hello world."
I've searched the help files but i found that replace() together with toUpperCase() wouldn't quite work.

Thanks,
Tilpo.

Making A Cartoon Character Walk?
Hmm! 1st time here! Wanna ask do anyone here noe how to make a cartoon charc. walk??

I dont now whether is there any thread here as ii cant fiind it! Can anyone help?

Making A Game- Don't Want To Have The Character Walk Through Buildings
I am in the middle of making a game, and I have a character who is controlled by the arrow keys. I don't want him walking through the trees and buildings, and other stuff and I don't know how to do this. I thought it might have to use hitTest, but I have been having troubles with it. Any ideas? (I'm a bit of a newbie to actionscript )

Making Movie Clip Character Face A Certain Way
At the moment I'm making a game. It involves a character with a jet pack. The jetpack has "thrusters" on the back to go forward and on the bottom to rise. My problem is Ive made a different Key frame for each direction as you normally would but the problem is when I want just the thruster to go upward I need it to use the Key frame in accordance to which direction it faces. So an example of the actionscipt:

onClipEvent (enterFrame) {
if (Key.isDown(Key.UP)) {
yspeed -= jump
this.gotoAndStop("jetpackleft");

The character might be facing right but if I press up to use the jet pack upwards he will face left because of that keyframe. How might I go about fixing this?

A Flash Speaking Character Making Tool, Need Testing
Hi

I have just made a flash speaking character making tool (you could fill in the text, and generate the swf file which speak the words with lipsync). Could you test it for me? It is the download link :

http://www.flashspeech.com/download/fs_free1.msi
(for win xp / 2000)

Any comment would be helpful. Thanx a lot.

Best Wishes,
Jack SO

Flash Speech Character Making Tool, Need Testing
Hi

I have just made a flash speech character making tool (you could fill in the text, and generate the swf file which speak the words with lipsync). Could you test it for me? It is the download link :

http://www.flashspeech.com/download/fs_free1.msi
(for win xp / 2000)

Any comment would be helpful. Thanx a lot.

Best Wishes,
Jack SO

Making A Movieclip Character Walk By Clicking A Mouse?
Hi, I am making a virtual world type website and I need help with making the character walk. What I want it to do is make it move towards the position the mouse clicks to, while walking in the direction the mouse has clicked.

For example, if the mouse clicks somewhere to the right of the character, it starts walking to the right, then slows down and stops once it's reached the position the mouse has clicked. Then I want it to stop walking but still be facing the right.
Also, I am wanting it to always look at the mouse cursor when the cursor moves around the screen but the character is staying in it's position. Like, if the character is facing north, then you move the cursor to the east of the character, it changes frames and faces east.
The character movieclip has 8 frames - facewest, walkwest, faceeast, walkeast, facenorth, walknorth, facesouth and walksouth.

Here is my code, with this code the character (gpb) does get to the position the mouse clicked on first, then when you click again it only stops half-way to the mouse. Why is this? Also, "g" is the variable of the ground that you click on to make gpb move. Thanks.








Attach Code

g.addEventListener(MouseEvent.CLICK, goto);

var startX = gpb.x
var startY = gpb.y

var moveX = 0;
var moveY = 0;
var moveeast = 0;
var movewest = 0;
var movenorth = 0;
var movesouth = 0;

function goto(event:MouseEvent){
gpb.addEventListener(Event.ENTER_FRAME, moveit);
var topositionx = mouseX
var topositiony = mouseY
function moveit(e:Event){
for(i=1;i<10;i++){
var i=10
var X = topositionx - 60;
var Y = topositiony - -20;
gpb.x = gpb.x + (X - gpb.x)/10;
gpb.y = gpb.y + (Y - gpb.y)/10;
}
}
var destX = topositionx;
var destY = topositiony;

moveX = destX - startX
moveY = destY - startY

if(moveX > 0){moveeast = moveX}
if(moveX < 0){movewest = moveX}
if(moveY < 0){movenorth = moveY}
if(moveY > 0){movesouth = moveY}

if(moveeast !=0 && moveX > moveY){
gpb.gotoAndStop('walkeast');
}
if(movewest !=0 && moveX < moveY){
gpb.gotoAndStop('walkwest');
}
if(movenorth !=0 && moveY < moveX){
gpb.gotoAndStop('walknorth');
}
if(movesouth !=0 && moveY > moveX){
gpb.gotoAndStop('walksouth');
}

}

Platformers: Whats The Code For Making The Level Move With The Character?
I have my character so it can move across the screen. It can jump and land on the ground and it can collect items. There are also enemies that move around - but what i dont know is how to make it so that the level moves along with the character. For example: if my character movie clip jumped the level would sort of jump too and if the charcater was going up a hill the character would be able to follow it rather then just go in a straight line. All i need is this code and then ill be able to make my platformer.

Detect Keyboard Release / Help Making A Walking Character Return To Stationary Stance
Hi,

Im making a walking character which moves <left> <right> <down> <up>. Im using a simple button which looks at which key the user is pressing and getsproperty for the correct action. Its all very nice until i found out i don't know how to make the character return to its normal forward stance.

Is it possible that on a button i can detect a keyboard release, or somehow insert the button (which has all the actionscript on) into a loop checking for if a key is being pressed?

thanks for your help and time

Jim

"Making The Jump" From Beginner AS To OOP
I've been teaching myself AS for about the past 6 months, as I've had time, and I feel like I have a good grasp on the basics. I've been through a ton of the tutorials on this site, including the AS/XML ones, and I think I'm ready to take the next step...

I always hear people talking about AS2.0 and 3.0, using OOP and classes and whatnot, and I really want to dive into that level of ActionScripting... So here's my question: Does anybody have any suggestions for studying/practicing/learning these more advanced AS techniques? Put me in, coach!

Thanks!

The & Character In Flash...how To Use URLs That Contain The & Character...
I am loading in an array or urls from my database via php into my flash movie.

the output of my script looks like this:



quote:
--------------------------------------------------------------------------------
&id=1,&imagelist=1.jpg,&urls=http://www.homemade.ch/shop/100/conliste.asp?langext=&katno=8|&titles=Silence|&com ments=Silence, a painting by Bea Fehr|
--------------------------------------------------------------------------------



problem is that the url contains the '&' character, which Flash uses to seperate the variables....

ex:

http://www.homemade.ch/shop/100/con...angext=&katno=8

but problem is that it is being read into flash as this:
http://www.homemade.ch/shop/100/con_liste.asp?langext=

becuase Flash cuts it off when he see the '&' sign.

How can I workaround this problem, has to be a common issue I would guess since lots of URLs have this format....?

Do I need to write some parsing code?

Jump Mask, Jump
How can i make the mask jump to a point when i rollover that place? (not follow the mouse as it does now..)

Here is the page how it is now:
netmedia

Keeping Character On Stage Plus Keeping Moving Background With Character On Stage
Im in the process of creating a superman game.. and i right now have him in walking mode .. i created him which is superman_mc . which has his waking animations etc.. inside and i have created a background mc which is level1_mc which basicly moves along with superman as he walks. .the problem i am getting is keeping the back ground from moving off the stage and superman from going off the stage i can keep superman on the stage and in one place on the stage with the code i have now but the background still moves off.. here is the code i have :
stop();
//Superman walk & flying movements
fly = "off";
_root.onEnterframe = function() {
if (Key.isDown(70)) {
_root.superman_mc.gotoAndPlay(4);
_root.superman_mc._y -= 17;
fly = "on";
}
if (_root.superman_mc, hitTest(_root.right_mc)) {
_root.superman_mc._x = 700;
}
//moves superman right
if (Key.isDown(39) & fly == "off") {
_root.superman_mc.gotoAndPlay(3);
_root.superman_mc._x += 17;
_root.level1_mc._x -= 17;
direction = "center";
//makes superman face foward
} else if (direction == "center") {
_root.superman_mc.gotoAndStop(1);
}
//moves superman left
if (Key.isDown(37) & fly == "off") {
_root.superman_mc.gotoAndPlay(2);
_root.superman_mc._x -= 17;
_root.level1_mc._x += 17;
direction = "left";
} else if (direction == "left") {
_root.superman_mc.gotoAndStop(1);
}
};
whats happening is that the background keeps going but since i have it setup to move along with superman .. if anyone can help thank you alot..

-rob-

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