Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

Logged in as:
.
Logging out…
Inbox My Account Log Out


Forum Topic: Rpg Actionscript Question

(379 views • 11 replies)

This topic is 1 page long.

<< < > >>
Questioning

will-macey

Reply To Post Reply & Quote

Posted at: 12/12/05 06:15 PM

will-macey DARK LEVEL 10

Sign-Up: 05/28/04

Posts: 35

To those of you taking your time, Thankyou. I just had one question. To anybody that knows this or knows where I can find the source Actionscript, please tell me how I can make it so the Main Character (mc) will be sent behind another MC, say a Villager (mc), when the maincharacter walks above him. This is an overview RPG game and I need the main character to be under an MC when he's behind objects, and above the MC when he's in front of them.

I hope you understand where I'm getting with this, and I apreciate your time. When I'm done with my game I will be sure to give you credit in the Credits.


None

repenter

Reply To Post Reply & Quote

Posted at: 12/12/05 06:31 PM

repenter LIGHT LEVEL 33

Sign-Up: 01/28/05

Posts: 1,556

You mean a cattipillar movment?
I don't know the script for Macro MX or MX04 I do have it for RPG Maker 03.


None

will-macey

Reply To Post Reply & Quote

Posted at: 12/12/05 06:40 PM

will-macey DARK LEVEL 10

Sign-Up: 05/28/04

Posts: 35

No I did mean for Flash. Thanks anyway though.


None

Thomas

Reply To Post Reply & Quote

Posted at: 12/12/05 07:01 PM

Thomas LIGHT LEVEL 13

Sign-Up: 02/14/05

Posts: 2,382

I'm sure it has something to do with Depths :\

Why am I still so hungry?


None

authorblues

Reply To Post Reply & Quote

Posted at: 12/12/05 07:05 PM

authorblues FAB LEVEL 12

Sign-Up: 06/21/05

Posts: 6,263

At 12/12/05 07:01 PM, -Thomas- wrote: I'm sure it has something to do with Depths :\

you would have to set up a depth field. find their xy coordinates on the map, and do something like: player.swapDepths((y*100)+x); that way, if an object is at a higher y value, its depth is higher. you can tweak that to your liking, but thats the general idea...

my blog. smash code: 3523-1700-9216 [AUTHR]

BBS Signature

None

will-macey

Reply To Post Reply & Quote

Posted at: 12/12/05 07:45 PM

will-macey DARK LEVEL 10

Sign-Up: 05/28/04

Posts: 35

where do you suggest i put that code, in the object to pass or the character MC?


None

Madferit

Reply To Post Reply & Quote

Posted at: 12/12/05 09:15 PM

Madferit FAB LEVEL 10

Sign-Up: 07/29/05

Posts: 3,361

At 12/12/05 07:05 PM, authorblues wrote:
At 12/12/05 07:01 PM, -Thomas- wrote: I'm sure it has something to do with Depths :\
you would have to set up a depth field. find their xy coordinates on the map, and do something like: player.swapDepths((y*100)+x); that way, if an object is at a higher y value, its depth is higher. you can tweak that to your liking, but thats the general idea...

I strangey have never tried swapDepths before but I am guessin it would be...(on the main char mc)

onClipEvent(enterFrame){
if(this.hitTest(_root.villager)){
this.swapDepths((y*100)+x);
}
}


None

authorblues

Reply To Post Reply & Quote

Posted at: 12/12/05 09:21 PM

authorblues FAB LEVEL 12

Sign-Up: 06/21/05

Posts: 6,263

At 12/12/05 09:15 PM, -Gifts- wrote:
At 12/12/05 07:05 PM, authorblues wrote:
At 12/12/05 07:01 PM, -Thomas- wrote: I'm sure it has something to do with Depths :\
you would have to set up a depth field. find their xy coordinates on the map, and do something like: player.swapDepths((y*100)+x); that way, if an object is at a higher y value, its depth is higher. you can tweak that to your liking, but thats the general idea...
I strangey have never tried swapDepths before but I am guessin it would be...(on the main char mc)
[code]

no

onClipEvent(enterFrame){
this.swapDepths((y*100)+x);
}

thats assuming youre running a tile-based system, which you should be. otherwise, youll want to reference the actual _x and _y values...

my blog. smash code: 3523-1700-9216 [AUTHR]

BBS Signature

None

ImpotentBoy2

Reply To Post Reply & Quote

Posted at: 12/12/05 09:26 PM

ImpotentBoy2 LIGHT LEVEL 18

Sign-Up: 04/01/03

Posts: 5,028

why would you use _x and _y, wouldnt just _y be fine.


None

authorblues

Reply To Post Reply & Quote

Posted at: 12/12/05 09:37 PM

authorblues FAB LEVEL 12

Sign-Up: 06/21/05

Posts: 6,263

At 12/12/05 09:26 PM, ImpotentBoy2 wrote: why would you use _x and _y, wouldnt just _y be fine.

because if two objects were standing in the same square, that would give them the same depth, and one would get deleted. if they are at the same _y, but different _x's, this will make sure they arent given the same depth...

there are better ways to do this, that was just the solution i thought of at the moment...

my blog. smash code: 3523-1700-9216 [AUTHR]

BBS Signature

None

ImpotentBoy2

Reply To Post Reply & Quote

Posted at: 12/12/05 11:02 PM

ImpotentBoy2 LIGHT LEVEL 18

Sign-Up: 04/01/03

Posts: 5,028

i dont really think _x would solve that, although i guess it the object worked like a wall then it would be good.

but wouldnt it where if your depth was att 99 and a tree was at 100, wouldnt it switch the depths when your depth gets to 100, and not make them the same.

ive never tried this but what i did b4 was give stationary objects even number depths and give the character odd number and increase in by 2 when it moves up. it worked good.


None

authorblues

Reply To Post Reply & Quote

Posted at: 12/12/05 11:07 PM

authorblues FAB LEVEL 12

Sign-Up: 06/21/05

Posts: 6,263

At 12/12/05 11:02 PM, ImpotentBoy2 wrote: i dont really think _x would solve that, although i guess it the object worked like a wall then it would be good.

the _x value just keeps it offset enough to fix the deletion problem. with my code, the only way two objects would be on the depth is if they were standing in the same square, which, with tile-based rpg setup, shouldnt happen in the first place.

but wouldnt it where if your depth was att 99 and a tree was at 100, wouldnt it switch the depths when your depth gets to 100, and not make them the same.

well, if the tree's _y value was 100, and the guy was standing at _y = 101 (closer to the bottom of the screen and the "camera"), his depth would be higher with my code. again, not perfect, but something decent.

ive never tried this but what i did b4 was give stationary objects even number depths and give the character odd number and increase in by 2 when it moves up. it worked good.

thats what i do. what you do with the objects themselves depths is your own business, but i find that using the odd-even method has ALWAYS worked for me. i actually used that for the depth field i made for my newest game.

my blog. smash code: 3523-1700-9216 [AUTHR]

BBS Signature

All times are Eastern Daylight Time (GMT -4) | Current Time: 11:36 PM

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