Forum Topic: Actionscript codes here!

(210,390 views • 8,558 replies)

This topic is 286 pages long. [ 173145 | 146 | 147 | 148 | 149217286 ]

<< < > >>
None

Frenchi

Reply To Post Reply & Quote

Posted at: 8/5/04 05:01 PM

Frenchi NEUTRAL LEVEL 03

Sign-Up: 08/05/04

Posts: 9

Howdy. Ive got an RPG in development, and I was curious about the world layout. If I keep different sections in different frames, (for example, different rooms of a house each in their own frame) would it affect things like variables? (I.E. would I have to re-set the variables each time the frame changes or are they universal?)

Also, with that set up I have created a movie clip with 0 alpha as an "Activation Square" to set off certain events. Im trying to connect the different frames through this activation square, so that when the character steps on the activation square in the doorway, it changes the frame (thus changing the room). However, the character just seems to walk over it and nothing happens. The script I have for it now reads:

onClipEvent (enterFrame) {
if (this, hitTest(_root.Robo)) {
gotoAndStop(3);
}
}

(The next room is in frame three of course.) What seems to be the problem?

-Frenchi


None

Skribble-Style

Reply To Post Reply & Quote

Posted at: 8/5/04 07:36 PM

Skribble-Style EVIL LEVEL 07

Sign-Up: 05/18/03

Posts: 65

well making an RPG with each frame containing part of a level would be orite if ur making a small RPG like franks adventure. But if u want to make sumthing bigger look into loading levels from the library with attachMovie. anyway....

ur code is wrong

onClipEvent (enterFrame) {
if (this.hitTest(_root.Robo)) {
gotoAndStop(3);
}
}

also check the ur instance name of ur "Robo" has a capital R and not a lower case r . Remember instances are case sensative.


None

Frenchi

Reply To Post Reply & Quote

Posted at: 8/5/04 08:56 PM

Frenchi NEUTRAL LEVEL 03

Sign-Up: 08/05/04

Posts: 9

Yes, its going to be quite expansive, and this level loading intrigues me. How exactly does it work? Removing the movie clip for the current level and fetching another from the library in the same frame?

That would solve my inventory problem... right now its a movie clip that sits offscreen, comes onto the screen when the inventory button is clicked, and moves back offscreen when closed. Creates a problem when switching frames, doesnt stay consistent.

Anyway, thanks for the code correction!

-Frenchi


Questioning

Red-Bull-2004

Reply To Post Reply & Quote

Posted at: 8/5/04 09:14 PM

Red-Bull-2004 NEUTRAL LEVEL 10

Sign-Up: 02/16/04

Posts: 58

I need to know how to make stuff in a sprite game like playing the walking animation when u press left and right and the attack animation when u press shift. I will use the script to build my knowledge and try to do the rest. OR u could show me a site with a tutorial on making a sprite game


None

Nemo

Reply To Post Reply & Quote

Posted at: 8/5/04 09:19 PM

Nemo LIGHT LEVEL 34

Sign-Up: 06/13/03

Posts: 1,897

At 8/5/04 09:14 PM, Red_Bull_2004 wrote: I need to know how to make stuff in a sprite game like playing the walking animation when u press left and right and the attack animation when u press shift. I will use the script to build my knowledge and try to do the rest. OR u could show me a site with a tutorial on making a sprite game

try this for sprites: Tutorial and this for the actionscript: another tutorial. hope that helps


None

Skribble-Style

Reply To Post Reply & Quote

Posted at: 8/5/04 09:53 PM

Skribble-Style EVIL LEVEL 07

Sign-Up: 05/18/03

Posts: 65

GEEZ!. dont u people read anything? i think in all 140+ pages in this thread theres like 2 walking scripts per page!


None

Red-Bull-2004

Reply To Post Reply & Quote

Posted at: 8/5/04 09:54 PM

Red-Bull-2004 NEUTRAL LEVEL 10

Sign-Up: 02/16/04

Posts: 58

Thanks a bunch!


None

Skribble-Style

Reply To Post Reply & Quote

Posted at: 8/5/04 10:05 PM

Skribble-Style EVIL LEVEL 07

Sign-Up: 05/18/03

Posts: 65

Sumone should go through all the posts and document the code and release a document of it or sumthing. Im sure half the reason people dont search is coz they cant be bothered looking through 50% of crap.


None

That-Is-Bull

Reply To Post Reply & Quote

Posted at: 8/6/04 01:24 AM

That-Is-Bull EVIL LEVEL 22

Sign-Up: 04/29/04

Posts: 5,992

I have a question. I'm making a Save Kenny game to go along with my Cartman soundboard (South Park) and in the game, Kenny is at the bottom of the screen. The mouse is hidden, and I used the gun script on the first page, so Kenny follows your mouse left and right but stays at the bottom. I want a bunch of knives to keep falling from random places starting at the top, and they fall a little faster every 10 seconds. If a knife hits kenny, he dies and you lose. I just want the ActionScript for the knives.

what did the blind, deaf, paraplegic boy get for Christmas?

cancer.

BBS Signature

None

Red-Bull-2004

Reply To Post Reply & Quote

Posted at: 8/6/04 01:48 AM

Red-Bull-2004 NEUTRAL LEVEL 10

Sign-Up: 02/16/04

Posts: 58

I have a problem with a sprite game Im making. the part of the script I have trouble with is

}else if (Key.isDown(Key.SPACE)){
this.gotoAndStop(4)

It basically makes the character (Zero) attack when u press the space bar but it will only play the whole attack sequence when I hold the space bar down. Can someone help me to make it so that I can attack by just pressing it?


None

Red-Bull-2004

Reply To Post Reply & Quote

Posted at: 8/6/04 01:52 AM

Red-Bull-2004 NEUTRAL LEVEL 10

Sign-Up: 02/16/04

Posts: 58

O ya, and can someone tell me how to make a letter key do an action?


None

That-Is-Bull

Reply To Post Reply & Quote

Posted at: 8/6/04 02:00 AM

That-Is-Bull EVIL LEVEL 22

Sign-Up: 04/29/04

Posts: 5,992

At 8/6/04 01:48 AM, Red_Bull_2004 wrote: }else if (Key.isDown(Key.SPACE)){
this.gotoAndStop(4)

It basically makes the character (Zero) attack when u press the space bar but it will only play the whole attack sequence when I hold the space bar down. Can someone help me to make it so that I can attack by just pressing it?

I suck at ActionScript, but I'll give it a shot.

Try changing gotoAndStop(4) to gotoAndPlay(4)

what did the blind, deaf, paraplegic boy get for Christmas?

cancer.

BBS Signature

None

Red-Bull-2004

Reply To Post Reply & Quote

Posted at: 8/6/04 02:27 AM

Red-Bull-2004 NEUTRAL LEVEL 10

Sign-Up: 02/16/04

Posts: 58

nertz. Still does the same thing
thanks for trying though


None

PunkerFish

Reply To Post Reply & Quote

Posted at: 8/6/04 03:37 AM

PunkerFish EVIL LEVEL 08

Sign-Up: 03/21/04

Posts: 70

At 8/6/04 01:48 AM, Red_Bull_2004 wrote: I have a problem with a sprite game Im making. the part of the script I have trouble with is

}else if (Key.isDown(Key.SPACE)){
this.gotoAndStop(4)

It basically makes the character (Zero) attack when u press the space bar but it will only play the whole attack sequence when I hold the space bar down. Can someone help me to make it so that I can attack by just pressing it?

First you can try changing gotoAndStop(4); to gotoAndPlay(4);

If that doesn't work, try putting the code in it's own clip event.

onClipEvent (enterFrame) {
if (Key.isDown(Key.SPACE)) {
this.gotoAndPlay(4);
}
}


Questioning

PunkerFish

Reply To Post Reply & Quote

Posted at: 8/6/04 04:08 AM

PunkerFish EVIL LEVEL 08

Sign-Up: 03/21/04

Posts: 70

I have it so that when my characters punching MC hits the enemy, it plays the dying sequence and at the end of the dying sequence I have this.removeMovieClip(); but I have this code on the enemy MC:

onClipEvent (enterFrame) {
if (this._x > _root.player._x + 25) {
this._x -= 1;
_root.bad.play();
setProperty(this,_xscale, +45);
} else if (this._x < _root.player._x - 25) {
this._x += 1;
_root.bad.play();
setProperty(this,_xscale, -45);
} else {
_root.townsman.townsman_attack.play();
}
}

onClipEvent (enterFrame) {
if (this._y > _root.player._y) {
this._y -= 0.5;
_root.townsman.play();
} else if (this._y < _root.player._y) {
this._y += 0.5;
_root.townsman.play();
}
}

onClipEvent (enterFrame) {
if (this.hitTest(_root.player.punch.hit)) {
_root.townsman.gotoAndPlay(18);
}
}

I think the problem is that when the enemy is done dying, it's calling to the part that says } else { _root.townsman.townsman_attack.play(); and it's just going back to the attacking sequence. Is there a way to make him stay dead?


None

Jorg40

Reply To Post Reply & Quote

Posted at: 8/6/04 04:13 AM

Jorg40 NEUTRAL LEVEL 05

Sign-Up: 07/02/04

Posts: 4

Where did you buy that book??? On the internet? Please tell me!


None

Amish

Reply To Post Reply & Quote

Posted at: 8/6/04 06:40 AM

Amish NEUTRAL LEVEL 16

Sign-Up: 03/13/03

Posts: 2,989

try Amazon


None

Stevemyster

Reply To Post Reply & Quote

Posted at: 8/6/04 07:10 AM

Stevemyster NEUTRAL LEVEL 07

Sign-Up: 04/02/04

Posts: 45

im getting pretty pissed off here. im pretty sure its my comp. or thats wat other ppl have been tellling me. neways, im trinyg to make a m.c. follow the m.c. u control around the screen, and when the following m.c. hits the player, to goto and play the next frame. but its just not working. can someone gimme sum help here?


None

Amish

Reply To Post Reply & Quote

Posted at: 8/6/04 07:11 AM

Amish NEUTRAL LEVEL 16

Sign-Up: 03/13/03

Posts: 2,989

Show us what code you have now. coz youve described it in such a shit way.


None

schorhr

Reply To Post Reply & Quote

Posted at: 8/6/04 07:33 AM

schorhr NEUTRAL LEVEL 11

Sign-Up: 05/28/02

Posts: 9,029

What exactly is not working?

Sometimes people use gotoAndPlay("scene",1); without adding a _root.gotoAndPlay, but also sometimes
a gotoAndPlay to a scene is not working (known Bug in flash).
This is probably bacause in the SWF there is nothing such as scenes, and all gotoAndPlays>Scene wil be converted to frame numbers.
What you can do is that you make a _root.gotoAndPlay("FrameLabelName"), and you go to a frame in the other scene, go to properties CTRL+F3 and you enter a frame label. A small flag will mark the frame in the timeline.


Shouting

beyondanimations

Reply To Post Reply & Quote

Posted at: 8/6/04 08:23 AM

beyondanimations EVIL LEVEL 03

Sign-Up: 07/25/03

Posts: 133

i agree, a well known mistake.


None

Skribble-Style

Reply To Post Reply & Quote

Posted at: 8/6/04 11:12 AM

Skribble-Style EVIL LEVEL 07

Sign-Up: 05/18/03

Posts: 65

At 8/6/04 07:10 AM, Stevemyster wrote: im getting pretty pissed off here. im pretty sure its my comp. or thats wat other ppl have been tellling me. neways, im trinyg to make a m.c. follow the m.c. u control around the screen, and when the following m.c. hits the player, to goto and play the next frame. but its just not working. can someone gimme sum help here?


onClipEvent (load) {
velocity = 5;
}
onClipEvent (enterFrame) {
if (_root.man._x>this._x) {
this._x += velocity;
} else {
if (_root.man._x<this._x) {
this._x -= velocity;
}if (this.hitTest(_root.man)) {
_root.gotoAndPlay(2);
}
}
}


there you go. just change "man" to ur instance name for u MC.


None

That-Is-Bull

Reply To Post Reply & Quote

Posted at: 8/6/04 12:00 PM

That-Is-Bull EVIL LEVEL 22

Sign-Up: 04/29/04

Posts: 5,992

Eh-em, Ok, I'll ask it again.

How do I make knives appear in random places at the top of the screen and keep falling, while every few seconds falling a little faster?

what did the blind, deaf, paraplegic boy get for Christmas?

cancer.

BBS Signature

None

flashtoflash55

Reply To Post Reply & Quote

Posted at: 8/6/04 12:18 PM

flashtoflash55 LIGHT LEVEL 06

Sign-Up: 06/20/04

Posts: 92

At 8/6/04 12:00 PM, That-Is-Bull wrote: Eh-em, Ok, I'll ask it again.

How do I make knives appear in random places at the top of the screen and keep falling, while every few seconds falling a little faster?

someone already made a game like that, clickHere and click on Kill Kenny!!


None

That-Is-Bull

Reply To Post Reply & Quote

Posted at: 8/6/04 12:24 PM

That-Is-Bull EVIL LEVEL 22

Sign-Up: 04/29/04

Posts: 5,992

At 8/6/04 12:18 PM, flashtoflash55 wrote:
At 8/6/04 12:00 PM, That-Is-Bull wrote: Eh-em, Ok, I'll ask it again.

How do I make knives appear in random places at the top of the screen and keep falling, while every few seconds falling a little faster?
someone already made a game like that, clickHere and click on Kill Kenny!!

Oh. Well, mine will be less shitty, and it's just going to be an easter egg on my soundboard.

what did the blind, deaf, paraplegic boy get for Christmas?

cancer.

BBS Signature

None

flashtoflash55

Reply To Post Reply & Quote

Posted at: 8/6/04 12:35 PM

flashtoflash55 LIGHT LEVEL 06

Sign-Up: 06/20/04

Posts: 92

At 8/6/04 12:00 PM, That-Is-Bull wrote: Eh-em, Ok, I'll ask it again.

How do I make knives appear in random places at the top of the screen and keep falling, while every few seconds falling a little faster?

I can help you come to the site on my sig (Big Mikes Media) and meet me in the forums in the flash section "Pre-made action scripts or help with flash "i 'll tell you every thing (I'll explain later.)


None

Stevemyster

Reply To Post Reply & Quote

Posted at: 8/6/04 04:29 PM

Stevemyster NEUTRAL LEVEL 07

Sign-Up: 04/02/04

Posts: 45

onClipEvent (enterFrame) {
if(this.hitTest(_root.char.dan)){
_root.gotoAndStop(2);
}
}

thats the script i have inside the mc. (dan is the other mc of course).

im not xaclty a noob at a.s. but im not xactly a connoisseur, so thnx for the help so far. i didnt think ne1 wud reply.


None

Stevemyster

Reply To Post Reply & Quote

Posted at: 8/6/04 04:36 PM

Stevemyster NEUTRAL LEVEL 07

Sign-Up: 04/02/04

Posts: 45

o yea, 1 more thing, i did try Skribble_Style's a.s. and it still didnt work. it did follow (man) around but when they hit it didnt gotoAndPlay(2). i tried putting gotoAndStop(2) but that didnt work either.

-stevemyster


None

Skribble-Style

Reply To Post Reply & Quote

Posted at: 8/6/04 09:32 PM

Skribble-Style EVIL LEVEL 07

Sign-Up: 05/18/03

Posts: 65

ok is but is ur MC instances name "dan" ? if ur not sure wot an instance name is ill explain it.....

an instance name is used to identify the current MC from others of MC's. You change ur objects instance name in the properties panel.


None

Stevemyster

Reply To Post Reply & Quote

Posted at: 8/6/04 10:04 PM

Stevemyster NEUTRAL LEVEL 07

Sign-Up: 04/02/04

Posts: 45

ok, i know wat an instance name is and i did change it to man. it does follow him around but it doesnt gotoAndPlay frame 2. i dont know y.

just making sure: on the mc i want to go the next frame (enemy), i am supposed to put stop(); on the first keyframe right? cuz if it doesnt have the stop thing itll flash frame 1 and 2 all fast and crap.

-stevemyster


All times are Eastern Standard Time (GMT -5) | Current Time: 08:44 AM

<< Back

This topic is 286 pages long. [ 173145 | 146 | 147 | 148 | 149217286 ]

<< < > >>
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!