Home  | Login  | Register  | Help  | Play 

RE: Flash Q&A thread 3

 
Logged in as: Guest
  Printable Version
All Forums >> [Gaming Community] >> [Legends and Lore] >> Artists of Legend >> Art Academy >> RE: Flash Q&A thread 3
Page 4 of 16«<23456>»
Forum Login
Message << Older Topic   Newer Topic >>
3/19/2007 21:29:27   
EragonZZZZ
Member

whats wrong with onEnterFrame?
AQ  Post #: 76
3/19/2007 21:51:07   
petermaxo
Member

does anyone know what is wrong with my code? what I mean by the last frame is, say you had a movie clip with 7 frames in it, and a movie clip with 18 frames in it, and either one of them could be attatched to a scene. you want the scene to change exactly when whichever clip is attatched enters the last frame, i.e., the 7th or 15th.
AQ DF  Post #: 77
3/20/2007 17:47:38   
flsg
Member

well, you could just put a code in the 7th or the 15th frame lol
EragonZZZZ: because it's hard to maintain and you can have errors like petermaxo did before(erasing the previous onEnterFrame of the same clip)
if you don't have a note everywhere, even the best programmers could do the same error
AQ  Post #: 78
3/20/2007 18:18:33   
petermaxo
Member

I mean if I wanted 1 scene, and wanted it to end on either the 15th or 7th (or 13th, or 2764th...) depending on what movie was loaded. also, can someone PLEASE tell me something wrong with the code posted above
AQ DF  Post #: 79
3/20/2007 22:38:54   
EragonZZZZ
Member

Ah, flsg. Thou maketh a good point!

What do YOU use instead (when putting code on the timeline just doesn't work out)?

AQ  Post #: 80
3/21/2007 17:26:14   
petermaxo
Member

*ahem* does anyone hear me?
AQ DF  Post #: 81
3/21/2007 23:50:54   
Grie Velorn
Member

hey does anyone know why i get this error when i try to use LLB's battle system?
**Error** Scene=Scene 1, layer=Setup, frame=2:Line 1: ')' expected
if (_root HP<=0 {
AQ DF  Post #: 82
3/22/2007 7:11:53   
petermaxo
Member

it's supposed to be: if(_root.hp <= 0){
AQ DF  Post #: 83
3/22/2007 22:23:19   
Grie Velorn
Member

okay thanks ill try that
EDIT: thanks it worked

< Message edited by Grie Velorn -- 3/22/2007 22:27:49 >
AQ DF  Post #: 84
3/23/2007 16:39:24   
swenn
Member

Alright I got some Q;(flash 8 prof.)
I use this code for movement:

onClipEvent (load) {
	step = 5;
	movieWidth = 180;
	movieHeight = 180;	
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.RIGHT) && this._x<movieWidth) {
	this._x += step;
	} else if (Key.isDown(Key.LEFT) && this._x>20) {
		this._x -= step;
	} else if (Key.isDown(Key.UP) && this._y>20) {
		this._y -= step;
	} else if (Key.isDown(Key.DOWN) && this._y<movieHeight) {
		this._y += step;
	
	
	}
	
}


Now
how do i get it to show my walking animations? and my idle animation to the last direction moved when no key is pressed?



And:
how do I get to duplicate an movieclip at random point of the stage at random times?
AQ MQ  Post #: 85
3/23/2007 17:32:46   
flsg
Member

eragon: what do you mean?
Grie Velorn: also, even if flash is super weak at debugging, you can just read the infos of the bug XD
"')' expected" what do YOU think it is?
swenn: here's the simple way: just put a this.gotoAndPlay(frameNumberOrName) before the end of if statement
for the movie duplication:

I'm too lazy to write the good code, so I'll just show you the simple way:
_root.onEnterFrame=function(){
if(random(99)>90){
_root.attachMovie("linkageName", "newName", depth)
_root["newName"]._x=random(Stage.width)
_root["newName"]._y=random(Stage.height)

}
}

< Message edited by flsg -- 3/23/2007 17:37:44 >


_____________________________

My flash gallery
my game thread

flsg, proud old member of AQ(still playing :O)
AQ  Post #: 86
3/23/2007 21:19:11   
petermaxo
Member

do you have any problems in my code for me to fix?
AQ DF  Post #: 87
3/23/2007 23:52:27   
Grie Velorn
Member

@flsg:I dont have any action script know how at all only stop and gotoandplay and thats it so dont bug me about stuff like that cause i have no clue what to do but draw in it sorry if i sounded rude
AQ DF  Post #: 88
3/24/2007 3:40:38   
swenn
Member

_root.onEnterFrame=function(){ 
if(random(99)>90){ 
_root.attachMovie("linkageName", "newName", depth) 
_root["newName"]._x=random(Stage.width) 
_root["newName"]._y=random(Stage.height) 

} 
} 

Can you please explain me the code flsg, so I understand what it does?
AQ MQ  Post #: 89
3/24/2007 7:53:10   
petermaxo
Member

quote:

I have a string of code trying to attatch a movie clip to the _root. and make it play. Here is the (somewhat shortened) code:

_root.onEnterFrame = function(){
if(back == 1){
_root.attachMovie("grassback", "back", 1,{_x:225,_y:200})
}if(ename == "green slime"){
_root.attachMovie("greenslimeattack", "enemy", 2,{_x:400,_y:200})
}_root.enemy.play()
}

sometimes, the movie clip 'greenslimeattack' won't play, or it will be delayed. does anyone know what's wrong?


Just thought I'd repost this in case everyone forgot what my problem is.
AQ DF  Post #: 90
3/24/2007 15:05:07   
flsg
Member

swenn: I was using the simple way, so it might seems unorganised:
each time a frame passes, you make a random number between 0 and 99 and check if it's bigger than 90
if it's the case, attach the mc in the library where the linkage name is "insertNameHere". Then, give it a new name and a depth(for more informations check the help document about attachMovie). Then, use the new name and acces the mc and change it's x and y positions to a random number(the default positions is 0,0 when you attach a clip)

petermaxo: first of all, check if you can acces back on _root, which means see if the variable is on _root.
second: you put _root.enemy.play() after the if(), and I think your intention was to put it IN the if()
AQ  Post #: 91
3/24/2007 18:08:57   
petermaxo
Member

1. didn't help.
2. I am simplifying the code by putting it at the end. instead of:
if(_global.ename == "lava slime"){
_root.attachMovie("lavaslimeattack", "enemy", 2,{_x:400,_y:200})
_root.enemy.play()
}if(_global.ename == "fire slime"){
_root.attachMovie("fireslimeattack", "enemy", 2,{_x:400,_y:200})
_root.enemy.play()
}...
I only need:
if(_global.ename == "lava slime"){
_root.attachMovie("lavaslimeattack", "enemy", 2,{_x:400,_y:200})
}if(_global.ename == "fire slime"){
_root.attachMovie("fireslimeattack", "enemy", 2,{_x:400,_y:200})
}...
_root.enemy.play()


Edit: I realized what was wrong- I finally realized why everyone was complaining about my use of onEnterFrame. I deleted it and it worked fine. The reason the movie clip wouldn't play was that it was being continueously loaded and never made it past the first frame.

< Message edited by petermaxo -- 3/25/2007 13:50:39 >
AQ DF  Post #: 92
3/25/2007 18:55:38   
Myhos
Member

quote:

ORIGINAL: swenn

Alright I got some Q;(flash 8 prof.)
I use this code for movement:

onClipEvent (load) {
	step = 5;
	movieWidth = 180;
	movieHeight = 180;	
}
onClipEvent (enterFrame) {
	if (Key.isDown(Key.RIGHT) && this._x<movieWidth) {
	this._x += step;
	} else if (Key.isDown(Key.LEFT) && this._x>20) {
		this._x -= step;
	} else if (Key.isDown(Key.UP) && this._y>20) {
		this._y -= step;
	} else if (Key.isDown(Key.DOWN) && this._y<movieHeight) {
		this._y += step;
	}
}

Now
how do i get it to show my walking animations? and my idle animation to the last direction moved when no key is pressed?

And:
how do I get to duplicate an movieclip at random point of the stage at random times?

Alright I would of hoped that your doing this code on the frame but you aren't...anyhow the object that this code has been assigned has to be a movie clip, next go inside of the movie clip and create a new layer (lets say layer 1 has your drawing or what ever) name the new layer A&L now add a label (in the properties window) make the label" still " (don't put in the " or the spaces)now add a stop command( stop(); ) on the frame (on layer A&L) next create a new key frame for both layers. On the A&L layer name it " right " (don't put in the " or the spaces). Now make your code have this:

if (Key.isDown(Key.RIGHT) && this._x<movieWidth) {
this._x += step;
gotoAndPlay(right); PS you MIGHT need to have it "right"

now put your right movement animation on layer 1 frame 2 (right).

In case i didn't make any sense to you, take a look at kirupa's tut: http://www.kirupa.com/developer/mx2004/platform_game.htm

< Message edited by Myhos -- 3/25/2007 19:00:55 >
AQ DF  Post #: 93
3/27/2007 18:09:14   
petermaxo
Member

whenever I try to run this code, the output says

**Error** Scene=map, layer=Layer 1, frame=1:Line 9: ']' or ',' expected
_root.attatchMovie("plain", "space1_1plain", 1, [_x:0, _y:0]);
can anyone tell me where the problem is?
AQ DF  Post #: 94
3/27/2007 21:46:47   
lil boi blue
Member

i think its the space btw the ',' and the '1',
idk much about actionascript but i always thought words like AND, OR, IF, ELSE were better than using commas and periods
AQ DF  Post #: 95
3/27/2007 22:08:40   
Myhos
Member

well for and your normally use &&, anyhow the space won't make a difference, anyhow, try using = instead of :
AQ DF  Post #: 96
3/28/2007 15:41:12   
petermaxo
Member

never mind, I accidentally was using "[]" instead of "{}". the code reads thus:

_global.space1_1 = "plain"

if(_global.space1_1 == "plain"){
_root.attatchMovie("plain", "space1_1plain", 1, {_x:0, _y:0});
}

when I run the movie, nothing happens.
AQ DF  Post #: 97
3/28/2007 20:12:33   
flsg
Member

quote:



Edit: I realized what was wrong- I finally realized why everyone was complaining about my use of onEnterFrame. I deleted it and it worked fine. The reason the movie clip wouldn't play was that it was being continueously loaded and never made it past the first frame.

actually, I am the only one who's "complaining", so you should thank me (lol joke )

for the code, you wrote "attatch" while it should be "attach"

< Message edited by flsg -- 3/28/2007 20:13:35 >
AQ  Post #: 98
3/29/2007 6:33:33   
petermaxo
Member

oops, the stupid error fairy strikes again thanks

Edit: Man! These bugs are popping up faster than mushroms! If I have code attached to a frame in a movie clip:

this.onEnterFrame = function(){
_global.action = "hit"
}

and on a scene:

if(_global.ename == "green slime"){
_root.attachMovie("greenslimeattack", "enemy", 3,{_x:400,_y:300})
}root.enemy.play()
_root.onEnterFrame = function(){
if(_global.action == "hit"){
_root.attachMovie("playerhit", "player", 2, {_x:200,_y:300})
}if(_global.action == "attackcomplete"){
gotoAndStop("battle")
}
}

What could go wrong that would make the variable 'action' not change. It is defined in a previous scene.

< Message edited by petermaxo -- 3/29/2007 7:01:42 >
AQ DF  Post #: 99
3/29/2007 10:15:06   
Myhos
Member

Just an idea but you should start on a smaller flash project,action script can be your friend, or it can be a pain in the ass. Instead of going against the huge boss (in this case a flash rpg) you should level up a little by making smaller games. Besides the fact that it can be usually completed sooner (so faster gratification) you'll be able to understand code better.

also for your bugs, do you mean it just doesn't work or it does wacky things? if its the latter, i found that printing out the code can be a huge help.
AQ DF  Post #: 100
Page:   <<   < prev  2 3 [4] 5 6   next >   >>
All Forums >> [Gaming Community] >> [Legends and Lore] >> Artists of Legend >> Art Academy >> RE: Flash Q&A thread 3
Page 4 of 16«<23456>»
Jump to:



Advertisement




Icon Legend
New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts




Forum Content Copyright © 2018 Artix Entertainment, LLC.

"AdventureQuest", "DragonFable", "MechQuest", "EpicDuel", "BattleOn.com", "AdventureQuest Worlds", "Artix Entertainment"
and all game character names are either trademarks or registered trademarks of Artix Entertainment, LLC. All rights are reserved.
PRIVACY POLICY


Forum Software © ASPPlayground.NET Advanced Edition