Forum Topic: help please with this game.

(359 views • 27 replies)

This topic is 1 page long.

<< < > >>
None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 10:06 AM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

http://img106.images..workresievil24qn.swf

basically i am having trouble with the controls.
1- no matter what i try i cant get the character to go back to the stance when no keys are being pressed.
2- if you press left she'll move left, but then if you press space with the left key, she'll move left but in the pose of what the space key does. what script would tell this to stop happening.
3- is there a way via action script to tell the file to flip the character horizontal? it would save alot of time and scripting. is there a way to say "if the right key is pressed set the horizontal to default, however if the right key is pressed flip the mc horizontally.

thanks for any help :)


None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 10:39 AM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

bump


None

fwe

Reply To Post Reply & Quote

Posted at: 9/3/05 10:42 AM

fwe DARK LEVEL 08

Sign-Up: 07/24/03

Posts: 3,372

Post your code for your character so i can edit it

wtfbbqhax


None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 10:44 AM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

onClipEvent (load)
{
speed = 10;
}
onClipEvent (enterFrame)

{ if (Key.isDown(key.RIGHT))
{
this.gotoAndStop(64);
this._x = this._x + speed;
}

if (Key.isDown(key.LEFT))
{
this.gotoAndStop(4);
this._x = this._x - speed;
}
if (Key.isDown(key.DOWN))
{
this.gotoAndStop(3);
}
if (Key.isDown(key.UP))
{
this.gotoAndStop(7);
}
if (Key.isDown(key.SPACE))
{ this.gotoAndStop(55);
} }

that it currently, i was fiddling around with the whole if (!Key.isDown(Key.LEFT) and !Key.isDown(Key.RIGHT) and !Key.isDow....etc....etc....
but that didnt work, weather i got it wrong or not im not sure. also i tried dealing with "else" functions although frustration got the better of me.


None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 11:22 AM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

bump


None

Cleod-9

Reply To Post Reply & Quote

Posted at: 9/3/05 11:27 AM

Cleod-9 NEUTRAL LEVEL 22

Sign-Up: 06/06/05

Posts: 74

Now I don't know much about actionscripting, but it looks to me that you need some kind of code to tell the character to go back to the frame where she's standing still. Maybe something like:

if (Key.isUp) i dunno if there is such a thing

Then like gotoAndPlay/Stop("standingframe");

Lol, i hardly know anything about game making..


None

Paranoia

Reply To Post Reply & Quote

Posted at: 9/3/05 11:27 AM

Paranoia DARK LEVEL 31

Sign-Up: 04/22/05

Posts: 9,119

At 9/3/05 10:44 AM, pumpkinlover wrote:

:stuff

this._x = this._x + speed;

:other stuff

I know it isn't relevant to your question, but _x+=speed is sooo much nicer. And shorter.

A rate of change in sanity with respect to time.

BBS Signature

None

Paranoia

Reply To Post Reply & Quote

Posted at: 9/3/05 11:31 AM

Paranoia DARK LEVEL 31

Sign-Up: 04/22/05

Posts: 9,119

And now to your question!

Try adding:

else{gotoAndStop(standing still anim)}

to the end. Or better yet:

else{ if(direction==1){gotoAndStop(standing facing right anim)}
if(direction==0){gotoAndStop(standing facing left anim)}

I'll assume you can work out what to do with the direction bit. *NB I suck at AS I know...

A rate of change in sanity with respect to time.

BBS Signature

None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 11:48 AM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

else{ if(direction==1){gotoAndStop(standing facing right anim)}
if(direction==0){gotoAndStop(standing facing left anim)}

what does that do???


None

Paranoia

Reply To Post Reply & Quote

Posted at: 9/3/05 11:58 AM

Paranoia DARK LEVEL 31

Sign-Up: 04/22/05

Posts: 9,119

At 9/3/05 11:48 AM, pumpkinlover wrote: else{ if(direction==1){gotoAndStop(standing facing right anim)}
if(direction==0){gotoAndStop(standing facing left anim)}

what does that do???

The directions variable tells your charecter whether hes facing fight or left... Unless it's reserved by Flash, in which case use another name. Anyway just add "direction(or whatever)=1 after your commands for pressing right and so on.

Once again, I suck at AS so take no responsibility for this being crap.

A rate of change in sanity with respect to time.

BBS Signature

None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 12:08 PM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

niether of them worked.


None

Cleod-9

Reply To Post Reply & Quote

Posted at: 9/3/05 12:11 PM

Cleod-9 NEUTRAL LEVEL 22

Sign-Up: 06/06/05

Posts: 74

At 9/3/05 12:08 PM, pumpkinlover wrote: niether of them worked.

It looks like you need to learn some "while" coding, I know Basic for the TI-83 Plus and it's somewhat similar to actionscript so do know some programming stuff.

If you look up how to use it then you can probably just get it to play the movieclip or whatever while the button is being held down instead of every single if every single frame


None

ShotInTheHead

Reply To Post Reply & Quote

Posted at: 9/3/05 12:20 PM

ShotInTheHead LIGHT LEVEL 31

Sign-Up: 12/20/02

Posts: 3,449

if you use a whiel loop in flash, it does everythign in the loop on 1 frame. so if the whiel loop never ends, flash crashes. its best to use a if

if (!key.isDown(yourkeyhere) and !key.isDown(anotherkeyhere)) {

add as many !key.isDown you need.


None

Cleod-9

Reply To Post Reply & Quote

Posted at: 9/3/05 12:22 PM

Cleod-9 NEUTRAL LEVEL 22

Sign-Up: 06/06/05

Posts: 74

At 9/3/05 12:20 PM, ShotInTheHead wrote: if you use a whiel loop in flash, it does everythign in the loop on 1 frame. so if the whiel loop never ends, flash crashes. its best to use a if

if (!key.isDown(yourkeyhere) and !key.isDown(anotherkeyhere)) {

add as many !key.isDown you need.

eh.. alright well don't listen to me, i'm not an actionscript guy.. yet..

I'll start making games after i get a ton of submissons in the portal


None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 12:27 PM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

thats what im trying to do, with the else function, i may try putting a script with in the walk.mc itself


None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 03:32 PM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

bump


None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 03:45 PM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

bump


None

Nick

Reply To Post Reply & Quote

Posted at: 9/3/05 03:56 PM

Nick FAB LEVEL 22

Sign-Up: 08/22/05

Posts: 1,966

If you want to mak him flip so he is facing right just use xscale, and set it to 100. if you don't know how to do xscaled ask one of the nice people in this thread. :)


None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 05:30 PM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

dammit, of course ^ thanks, i new there was some way of doing it.


None

Nick

Reply To Post Reply & Quote

Posted at: 9/3/05 05:38 PM

Nick FAB LEVEL 22

Sign-Up: 08/22/05

Posts: 1,966

Anytime ;) It's always the simple things people forget...


None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/3/05 07:50 PM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

problem with the new script

onClipEvent (load)
{
speed = 10;
scale = _xscale;
}
onClipEvent (enterFrame)

{if (Key.isDown(Key.RIGHT)) {
_xscale = -scale;
_x += Speed;
this.gotoAndStop(4);
}
if (Key.isDown(Key.RIGHT)) {
_xscale = -scale;
_x += Speed;
this.gotoAndStop(4);
}
if (Key.isDown(key.DOWN))
{
this.gotoAndStop(3);
}
if (Key.isDown(key.UP))
{
this.gotoAndStop(7);
}
if (Key.isDown(key.SPACE))
{ this.gotoAndStop(55);
} }

for some strange reason when i press right or left (doesnt matter) the character mc seems to suddenly appear the other side of the screen....it makes no sense? have i not put in the xscale right?


None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/4/05 05:28 AM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

bump


None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/4/05 08:12 AM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

bump


None

TrueDarkness

Reply To Post Reply & Quote

Posted at: 9/4/05 09:29 AM

TrueDarkness EVIL LEVEL 27

Sign-Up: 08/31/04

Posts: 4,718

Take out what you have up top where it says _xscale= .scale or whatever you said, thats number 1. Number 2 get rid of all of those same .scale things from the Right and... Right keypresses. Now put this lil code in

on (keyPress "<Left>") {
this._xscale = 100
}
on (keyPress "<Right>") {
this._xscale = -100
}

And tada, when you press right, it goes right, and left, it goes left. If the character streetches then change the number 100 to whatever number makes it not stretch.


None

EliteJimJam

Reply To Post Reply & Quote

Posted at: 9/4/05 10:30 AM

EliteJimJam LIGHT LEVEL 08

Sign-Up: 07/06/05

Posts: 9

bump lol


None

Disarray-yarrasiD

Reply To Post Reply & Quote

Posted at: 9/4/05 11:25 AM

Disarray-yarrasiD DARK LEVEL 08

Sign-Up: 11/14/04

Posts: 1,468

ever heard of the }else{ function?

ex:
if(Key.isDown(Key.LEFT)){
gotoAndStop(2)
}else{
if(Key.isDown(Key.RIGHT)){
gotoAndStop(3)
}else{
if(Key.isDown(Key.UP)){
gotoAndStop(4)
}else{
if(Key.isDown(Key.SPACE)){
gotoAndStop(5)
}else{
gotoAndStop(1)
}
}
}
}

BBS Signature

None

Disarray-yarrasiD

Reply To Post Reply & Quote

Posted at: 9/4/05 11:27 AM

Disarray-yarrasiD DARK LEVEL 08

Sign-Up: 11/14/04

Posts: 1,468

or

if you like using _xscale:

ex:
if(Key.isDown(Key.LEFT)){
gotoAndStop(2)
_xscale=100
_x-=movement
}else{
if(Key.isDown(Key.RIGHT)){
gotoAndStop(3)
_xscale=-100
_x-=movement
}else{
if(Key.isDown(Key.UP)){
gotoAndStop(4)
}else{
if(Key.isDown(Key.SPACE)){
gotoAndStop(5)
}else{
gotoAndStop(1)
}
}
}
}

tada

ps if you want a jump code I'll make one for you

BBS Signature

None

pumpkinlover

Reply To Post Reply & Quote

Posted at: 9/5/05 05:22 AM

pumpkinlover NEUTRAL LEVEL 02

Sign-Up: 08/13/04

Posts: 592

thanks for the help.
if you wish to make a jump code go ahead, although i tried but i had problems with the animation.


All times are Eastern Standard Time (GMT -5) | Current Time: 11:15 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!