Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

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

Reply
 
Thread Tools Rate Thread Display Modes
Old 07-23-2002, 05:43 AM   #1
MuRkYsLaYeR
Registered User
 
MuRkYsLaYeR's Avatar
 
Join Date: Jul 2002
Posts: 10
Send a message via AIM to MuRkYsLaYeR
Default Side-scrolling game question

I'm working on making a side-scrolling game that has this ninja guy that runs around fighting enemies. I have the moving and background scrolling scripts complete, but I don't know how to make it show his walk animation while he moves, the idle animation while he's not moving, and how to show the sword animation when you hit enter. Any ideas? Thanks
MuRkYsLaYeR is offline   Reply With Quote
Old 07-23-2002, 07:49 AM   #2
xxlm
Meuh? MMeuh!
 
xxlm's Avatar
 
Join Date: Sep 2001
Location: Auckland - New Zealand
Posts: 3,049
Send a message via ICQ to xxlm Send a message via AIM to xxlm Send a message via MSN to xxlm Send a message via Yahoo to xxlm
Default

Your controler is on a MC isn't it... If not it should be on it... In that case you can at every frame do an action...

Then you have your dummy... Only put on this dummy Mc all the states it have (up, crouch, walking, sword, and so on ...).
Then from the controler, gotoAndPlay() them...
I've made this before (and never finish it)... Look for it and send it to you...

__________________
I'm a froggy, so excuse me for my poor english
Blog - Dev By MX
For any jobs go on my blog on the contact page...

Last edited by xxlm; 07-23-2002 at 07:59 AM..
xxlm is offline   Reply With Quote
Old 07-23-2002, 08:06 AM   #3
xxlm
Meuh? MMeuh!
 
xxlm's Avatar
 
Join Date: Sep 2001
Location: Auckland - New Zealand
Posts: 3,049
Send a message via ICQ to xxlm Send a message via AIM to xxlm Send a message via MSN to xxlm Send a message via Yahoo to xxlm
Default

here is the link to the zip file of my old old old dummy
http://www.lagoon.nc/xavier/fight/chunli_zero.zip
(1mb)

The char is only for the example...
Don't forget to look in your controler if your oldstate == the state you want. In that case don't gotoAndplay.yourdummy.("yourstate"); And only do the move function (or else);

PS:import the chunli_zero.swf into a enmptyMC

Ok?

__________________
I'm a froggy, so excuse me for my poor english
Blog - Dev By MX
For any jobs go on my blog on the contact page...

Last edited by xxlm; 07-23-2002 at 08:09 AM..
xxlm is offline   Reply With Quote
Old 07-23-2002, 03:06 PM   #4
MuRkYsLaYeR
Registered User
 
MuRkYsLaYeR's Avatar
 
Join Date: Jul 2002
Posts: 10
Send a message via AIM to MuRkYsLaYeR
Default

Um...? I think I got most of what you said, thanks for the file, I'll check it out.
MuRkYsLaYeR is offline   Reply With Quote
Old 07-23-2002, 03:25 PM   #5
MuRkYsLaYeR
Registered User
 
MuRkYsLaYeR's Avatar
 
Join Date: Jul 2002
Posts: 10
Send a message via AIM to MuRkYsLaYeR
Default

Yeah, I looked that .fla file over and that's exactly what I had done, but what is the actionscript for it? EXAMPLE:
you press control, and it shows the punch animation.

I tried this:
Code:
if (keyDown(CONTROL)) {
  guy.gotoAndPlay(2);
}
That didn't work though.
MuRkYsLaYeR is offline   Reply With Quote
Old 07-23-2002, 03:40 PM   #6
xxlm
Meuh? MMeuh!
 
xxlm's Avatar
 
Join Date: Sep 2001
Location: Auckland - New Zealand
Posts: 3,049
Send a message via ICQ to xxlm Send a message via AIM to xxlm Send a message via MSN to xxlm Send a message via Yahoo to xxlm
Default

In your main scene you have,

A MC called "CONTROLER". Then on it
ActionScript Code:
onClipEvent(enterFrame) { if (key.RIGHT) { if (_root.state <> "RIGHT") { _root.MyDummyMC.gotoAndPlay("RIGHTState"); _root.state = "RIGHT"; } _root.MyDummyMC._x += 10; // the speed of your char } if (key.LEFT) { if (_root.state <> ...) { ... } //your different state and action }

and for your code, it should be
ActionScript Code:
if (Key.isDown(codeforControl)) {   _root.yourpath.guy.gotoAndPlay(2); } // OR if (Key.CONTROL) {   _root.yourpath.guy.gotoAndPlay(2); }

Is it what you're looking for ?
__________________
I'm a froggy, so excuse me for my poor english
Blog - Dev By MX
For any jobs go on my blog on the contact page...

Last edited by xxlm; 07-23-2002 at 03:53 PM..
xxlm is offline   Reply With Quote
Old 07-23-2002, 03:42 PM   #7
MuRkYsLaYeR
Registered User
 
MuRkYsLaYeR's Avatar
 
Join Date: Jul 2002
Posts: 10
Send a message via AIM to MuRkYsLaYeR
Default

Yes I believe it is...what is the "yourpath" part of this though?
I put in the script you showed for a controller MC and modified it to this:
Code:
onClipEvent (enterFrame) {
	if (key.isDown(CONTROL)) {
		if (_root.state<>"RIGHT") {
			_root.guy.gotoAndPlay("jump");
			_root.state = "jump";
		}
		_root.guy._x+=5;
	}
}
but that doesn't work still! =/

Last edited by MuRkYsLaYeR; 07-23-2002 at 03:51 PM..
MuRkYsLaYeR is offline   Reply With Quote
Old 07-23-2002, 04:00 PM   #8
xxlm
Meuh? MMeuh!
 
xxlm's Avatar
 
Join Date: Sep 2001
Location: Auckland - New Zealand
Posts: 3,049
Send a message via ICQ to xxlm Send a message via AIM to xxlm Send a message via MSN to xxlm Send a message via Yahoo to xxlm
Default

Ok man, i'll explain all the line of the code...
ActionScript Code:
onClipEvent (enterFrame) { if (key.isDown(keycode)) { // keycode is i.e 17 for the CONTROL key if (_root.state<>"jump") { // look if you already gotoAndPlay the appropriate frame _root.guy.gotoAndPlay("jump"); // if not so play your dummy _root.state = "jump"; // you've played the dummy state } _root.guy._x+=5; } }

The yourpath is where you dummy is.
Look at the dummy you've got in my example... When you play the first frame of a state then it loops... That's why I look in the controler if the state I want is already played...
See what I mean ?

__________________
I'm a froggy, so excuse me for my poor english
Blog - Dev By MX
For any jobs go on my blog on the contact page...
xxlm is offline   Reply With Quote
Old 07-23-2002, 04:02 PM   #9
Ricod
(@_@) -("pretty lights")
 
Ricod's Avatar
 
Join Date: Sep 2001
Location: the Netherlands
Posts: 3,988
Default

the yourpath refers to your path. Since its not known to us ... lets say your path is _root.myGame.myGuy.Guy; well, that be your path, but since we don't know that ...

did u check _root.state ? Is there a label "jump" in _root.guy ? Are both the guy as the control mc in the same _level ?
__________________
RicoD
Link ?
Ricod is offline   Reply With Quote
Old 07-23-2002, 04:44 PM   #10
MuRkYsLaYeR
Registered User
 
MuRkYsLaYeR's Avatar
 
Join Date: Jul 2002
Posts: 10
Send a message via AIM to MuRkYsLaYeR
Default

Alright I have the jump part working now. One problem though, the jump only works the first time I hit control, after that it doesn't work anymore.
here's how I have the "guy" MC set up:
=FRAME ONE=
standing still
-actions-
stop();

=FRAMES TWO THRU EIGHT=
jumping
-actions-
on frame eight-
gotoAndPlay(1);
MuRkYsLaYeR is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
2 Player Game Question JayDuck12 ActionScript 1.0 (and below) 9 04-27-2004 03:41 AM
The good ol' "Yugop" side scrolling Menu! Deadhands ActionScript 1.0 (and below) 2 12-18-2003 06:04 AM
Vertical Scrolling in a Art Based Platform Game Ninfoxwoods Gaming and Game Development 20 11-08-2003 11:24 PM
question re:continuously scrolling text field tutorial holdaway ActionScript 1.0 (and below) 0 08-09-2001 09:16 AM
JESSE - QUESTION relative content scrolling udminc ActionScript 1.0 (and below) 4 01-16-2001 04:00 PM


All times are GMT. The time now is 01:10 PM.


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