Forum Topic: AS3- Multiple platforms help.

(114 views • 9 replies)

This topic is 1 page long.

<< < > >>
Elated

12121231

Reply To Post Reply & Quote

Posted at: 7/25/09 02:51 AM

12121231 NEUTRAL LEVEL 01

Sign-Up: 07/22/09

Posts: 17

Hi everyone working on my game. I can't figure out a method of making multiple platforms.
I'm using this at moment if(man.hitTestObject(ground)) { . What is the coding i need in order to be able to create multiple platforms?


None

billowillo

Reply To Post Reply & Quote

Posted at: 7/25/09 03:16 AM

billowillo DARK LEVEL 15

Sign-Up: 04/21/08

Posts: 685

ive become familiar with as3, and yet this question still bothers me. because im sure there is an easier way to do it than how i do.

what i do is just what you did, but a different collision for each platform. and as you can imagine the code gets VERY sloppy and out of control. if anyone knows a better way, please post.

BBS Signature

None

InnerChild548

Reply To Post Reply & Quote

Posted at: 7/25/09 04:04 AM

InnerChild548 FAB LEVEL 23

Sign-Up: 08/10/07

Posts: 2,486

At 7/25/09 03:16 AM, billowillo wrote: what i do is just what you did, but a different collision for each platform. and as you can imagine the code gets VERY sloppy and out of control. if anyone knows a better way, please post.

A for..in loop with all of the objects on the stage?

THIS IS THE ORIGINAL SIG. FUCK YOU.
vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

BBS Signature

None

UnknownFury

Reply To Post Reply & Quote

Posted at: 7/25/09 06:22 AM

UnknownFury EVIL LEVEL 26

Sign-Up: 08/10/05

Posts: 6,031

Stick all the platforms in one MC called 'ground' and then use hitTestPoint. Test multiple points if that is not accurate enough for you.

Portfolio(Under construction): UnknownFury.com |
Msn: giant_ak_47@msn.com | Contact: me@unknownfury.com
Follow me on twitter!


None

nimmysnv

Reply To Post Reply & Quote

Posted at: 7/25/09 10:31 AM

nimmysnv NEUTRAL LEVEL 02

Sign-Up: 07/25/09

Posts: 1

For creating multiple platforms of the same type, and all subject to the exact collision call is very usefull and removes lot of bloated code, so this needs to be work out.


None

12121231

Reply To Post Reply & Quote

Posted at: 7/26/09 05:18 AM

12121231 NEUTRAL LEVEL 01

Sign-Up: 07/22/09

Posts: 17

Stick all the platforms in one MC called 'ground' and then use hitTestPoint. Test multiple points if that is not accurate enough for you.

Thanks, Can i have example please, I'm not very good, just started:)


None

Paranoia

Reply To Post Reply & Quote

Posted at: 7/26/09 05:40 AM

Paranoia DARK LEVEL 34

Sign-Up: 04/22/05

Posts: 9,697

At 7/25/09 06:22 AM, UnknownFury wrote: Stick all the platforms in one MC called 'ground' and then use hitTestPoint. Test multiple points if that is not accurate enough for you.

This'll also let you draw irregular surfaces!

At 7/26/09 05:18 AM, 12121231 wrote: Thanks, Can i have example please, I'm not very good, just started:)

Something like:

if(ground.hitTestPoint(guy.x, guy.y, true)){
  ...
};

Bear in mind that hitTestPoint() uses the _root co-ordinate system. If your guy is nested inside something, as will probably be the case if you're using a scrolling screen, you'll need to convert his co-ordinates either manually or with localToGlobal():

absX = holder.guy.x * holder.scaleX + holder.x;
absY = holder.guy.y * holder.scaleY + holder.y;

(Or)

var absPos:Point = new Point(holder.localToGlobal(new Point(holder.guy.x, holder.guy.y));
BBS Signature

None

12121231

Reply To Post Reply & Quote

Posted at: 7/26/09 05:48 AM

12121231 NEUTRAL LEVEL 01

Sign-Up: 07/22/09

Posts: 17

Thankyou very much Paranoia and UnknownFury, I'll give it a go. Just one more question, this will sound dumb but how do you find out the coordinates of your flash file??


None

Paranoia

Reply To Post Reply & Quote

Posted at: 7/26/09 06:07 AM

Paranoia DARK LEVEL 34

Sign-Up: 04/22/05

Posts: 9,697

If you mean the stage, then everything should be default - (0, 0), 0 rotation, 100% scale, et c. So long as you don't screw that up with a vCam or something.

BBS Signature

None

12121231

Reply To Post Reply & Quote

Posted at: 7/27/09 05:04 AM

12121231 NEUTRAL LEVEL 01

Sign-Up: 07/22/09

Posts: 17

At 7/26/09 06:07 AM, Paranoia wrote: If you mean the stage, then everything should be default - (0, 0), 0 rotation, 100% scale, et c. So long as you don't screw that up with a vCam or something.

How can I use hitTestPoint then? Don't I need coordinates of the object????
I dont understand how to find out coordinates of the object.
Or on the stage do I just set the x and y coordinates to (0, 0,)???


All times are Eastern Standard Time (GMT -5) | Current Time: 11:27 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!