Go Back   gprime.net boards > projects and submissions > ask an expert

ask an expert stuck on your flash movie? can't get your program to work? ask an expert!

Reply
 
Thread Tools Display Modes
Old 10-15-2005, 04:17 AM   #1
Ilikepandas
Guest
 
Tournaments Won: 1

Default I need serious help with this- no crappy amateurs- major actionscript skill needed...

Okay, does anyone on this forum know how I can modify a movieclip's depth while playing a movie? What I mean is....

When a character in a game walks above another movieclip, he goes behind it.

When a character goes below of another movieclip he goes in front of it.

Because my actionscript is self taught, I usually find messy ways to overcome problems like these. I have managed to make this depth problem work for still objects but what I need is this to work for moving characters, which I have not found a good way to work. I know there is this swapDepth() thing but that doesn't seem to work very well in this situaion.

Anyone have any ideas? OR maybe a site that can help me here?
  Reply With Quote
Old 10-15-2005, 02:07 PM   #2
VooDoo
Guest
 
Tournaments Won: 1

Default

No offense panda i have no idea what your talking about, and yes i do understand actionscript before you say thats the reason you don't understand then.
  Reply With Quote
Old 10-15-2005, 05:16 PM   #3
Ilikepandas
Guest
 
Tournaments Won: 1

Default

Hmmm.. I was hoping you would know something because you're the best actionscripter on this forum from what i can see. I think I just didn't explain it very well. My apologies.
What my problem is (More technically):

Okay say theres a game and you can walk around.

When a guys _y value is higher than another objects in a movie, he goes behind it.

When his _y value is less than that of the object, he goes in front.
Therefore this would be achieving a 3d effect similar to that of 2d beatemup kind of games.

Now one solution might be to program a depth axis (z) and add this value to the _y value of objects so the higher an object is, the less _z value he has which would make objects with a larger _z value have a greater depth, making it go in front (Maybe using the swapDepth() command or maybe by changing the value of a movieclip). But I don't know how to do that.

Im not sure if this may be any less confusing than my last post, but its in more detail of what I want anyway.
Attached Images
File Type: jpg Help.JPG (11.8 KB, 15 views)
  Reply With Quote
Old 10-15-2005, 05:20 PM   #4
Charles rules you all!
My kitty
 

Default

The only way I do it is layering...I think you should try this...
Charles rules you all! is offline   Reply With Quote
Old 10-15-2005, 07:52 PM   #5
VooDoo
Guest
 
Tournaments Won: 1

Default

Quote:
Originally Posted by Charles rules you all!
The only way I do it is layering...I think you should try this...

He already knows how to do that but that could always be a way if you think of more creative layering, but i think he's looking for a sort of more mario 3 technique (e.g heres mario if your on level 3 and hold the down button for 5 secs on an object you fall behind the object and your then allowed to run the whole of the level behind the obstacles). I haven't come across that problem through my own curiosity but give a tick and i'll have an answer soon enough,

I could have it, when your little character mc crosses another mc that it tells it like a hit test to jump frame and go to a replica of your game where the layers are all changed it's sound's a bit complicated but it isn't really 6 layers max if you wanna do it that way.

I think this script that i wrote out would would work but i might probably have to explain it which wouldn't be a problem.

obj1_x = getProperty("/one", _x);
obj2_x = getProperty("/two", _x);
delta_x = obj1_x-obj2_x;
obj1_y = getProperty("/one", _y);
obj2_y = getProperty("/two", _y);
delta_y = obj1_y-obj2_y;
if (Number((Number(delta_x*delta_x)+Number(delta_y*de lta_y)))<=Number(((Number(radius1)+Number(radius2) )*(Number(radius1)+Number(radius2))))) {
/:output = "colliding";
_root.gotoAndPlay(100)


} else {
/:output = "not colliding";
}

Last edited by VooDoo; 10-16-2005 at 02:35 PM. Reason: I came up with an okay answer
  Reply With Quote
Old 10-16-2005, 11:09 PM   #6
Ilikepandas
Guest
 
Tournaments Won: 1

Default

Cool! I knew I could always trust voodoo for a good answer. Thankyou thankyou thankyou. This peice of code is handy for collision, and after a bit of figuring it out I think I understand it. Your idea of swapping frames for different layer combinations (Which sounds really good unless theres tons of objects in the levels) I had tried before, however it proved too awkward and inconvenient for the games I make.

If the layer swapping was as simple as Mario 3, I could use the different frames method, but I'm trying to use multiple movieclips that can swap at once.

When looking through the submissions section, someone found a game that had exactly the kind of depth/layer swapping I am thinking of- Dad'n me
As soon as the guy you play as goes lower than another character, he becomes in front of it.

Thank you for helping, when I finish this game I'll put you in the credits (If I manage to sort out this depth- problem anyway)
  Reply With Quote
Old 10-16-2005, 11:14 PM   #7
Ilikepandas
Guest
 
Tournaments Won: 1

Default

WAHOOO!!!! I FOUND OUT HOW TO DO !!!!!!

all I needed to do was add this code to my movie clips:
onClipEvent (enterFrame) {
this.swapDepths(this._y);
}

Now no matter where you are, the lower you are, the more in front you are. Thanks for helping me anyway!!!!
Attached Files
File Type: swf Depth test!.swf (19.2 KB, 14 views)

Last edited by Ilikepandas; 10-16-2005 at 11:18 PM.
  Reply With Quote
Old 10-17-2005, 02:28 AM   #8
VooDoo
Guest
 
Tournaments Won: 1

Default

I'm glad i inspired you into figuring it out yourself theres no need to throw me in the credits but if you feel like it go for it if you want.
  Reply With Quote
Old 10-17-2005, 05:42 AM   #9
Willy_Wonka
shit
 
Tournaments Won: 2

Default

In the words of coach Z... Good Jorb!
Willy_Wonka is offline   Reply With Quote
Old 10-17-2005, 05:28 PM   #10
Charles rules you all!
My kitty
 

Default

awesome.....I still cant make games I have no Idea how to do it...=(
Charles rules you all! is offline   Reply With Quote
Old 10-17-2005, 07:37 PM   #11
VooDoo
Guest
 
Tournaments Won: 1

Default

Totally off subject but does anybody like my gun i just finished making, i don't like making threads so i'll just post here, if you seen my last creation (the Girl) thats gonna be her super cool hand gun.
  Reply With Quote
Old 10-17-2005, 11:32 PM   #12
treefalse
Super-Tree
 
Tournaments Won: 1

Default

Quote:
Originally Posted by VooDoo
Make it less shiney on the handle. :D
treefalse is offline   Reply With Quote
Old 10-18-2005, 10:51 PM   #13
Ilikepandas
Guest
 
Tournaments Won: 1

Default

Quote:
Originally Posted by VooDoo
Totally off subject but does anybody like my gun i just finished making, i don't like making threads so i'll just post here, if you seen my last creation (the Girl) thats gonna be her super cool hand gun.
I like it. Its very detailed, and would easily blend into any movie
  Reply With Quote
Old 10-19-2005, 01:25 AM   #14
VooDoo
Guest
 
Tournaments Won: 1

Default

Thanks man i just can't wait till i get the girl ready to animate but it's so hard to rig a character to animate when your lame with 3d work, i do like a thousand things at the same time, i almost make that sound like a good thing but when your cpu crashes it's anything but good cause you don't know where anything is to rescue it.

Last edited by VooDoo; 10-19-2005 at 01:28 AM.
  Reply With Quote
Old 10-19-2005, 02:31 AM   #15
Ilikepandas
Guest
 
Tournaments Won: 1

Default

Ahhh well, you'll finish her in the end. The good thing is, the more 3d you do the better you will be at it.
  Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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


All times are GMT -5. The time now is 06:28 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright ©2005-2007 Gprime.Net