Newgrounds.com — Everything, By Everyone.

Checking login status…

USERNAME:

PASSWORD:

Logging in…

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


Forum Topic: Platformer shooter help!

(90 views • 7 replies)

This topic is 1 page long.

<< < > >>
None

TomsPulp

Reply To Post Reply & Quote

Posted at: 5/11/08 03:02 PM

TomsPulp LIGHT LEVEL 19

Sign-Up: 01/17/04

Posts: 1,147

onClipEvent (mouseMove) {
Xd =_root._xmouse-_x; //Get _x distance from gun to mouse
Yd =_root._ymouse-_y; //Get _y distance from gun to mouse
radAngle = Math.atan2(Yd, Xd); //Use atan2 to calculate the angle from gun to mouse
_rotation = int((radAngle*360 / (2*Math.PI))+90); //Use PI to calculate and set gun rotation
updateAfterEvent();
}

I put that on my duded gun/hand MC and it woks, but its like backwards and glitchy, how do I fix it?

And also, how do I make it so it can only aim on one side and not make a full circle.

Thanks

TomsPulp for Icon mod '08!
Message me if you need help on NG.

BBS Signature

None

LCurtis

Reply To Post Reply & Quote

Posted at: 5/11/08 03:16 PM

LCurtis NEUTRAL LEVEL 17

Sign-Up: 05/23/07

Posts: 1,077

Maybe you should go read up on the basics of AS before trying something complicated...
Or maybe you could find someone to code your game for you if you just want to be lazy.

support the dream ...

BBS Signature

None

TomsPulp

Reply To Post Reply & Quote

Posted at: 5/11/08 03:20 PM

TomsPulp LIGHT LEVEL 19

Sign-Up: 01/17/04

Posts: 1,147

.........I already have the game made....I just want to add this in.....

TomsPulp for Icon mod '08!
Message me if you need help on NG.

BBS Signature

None

xWELSHxDRAGONx

Reply To Post Reply & Quote

Posted at: 5/11/08 03:23 PM

xWELSHxDRAGONx NEUTRAL LEVEL 07

Sign-Up: 04/13/06

Posts: 462

u may need to make Yd negative, or add 180 degrees, or subtract randAngle from 180 degrees, without seeing what you got its hard to be sure which 1.


None

Coaly

Reply To Post Reply & Quote

Posted at: 5/11/08 03:27 PM

Coaly FAB LEVEL 20

Sign-Up: 08/11/04

Posts: 2,470

Basically you just need to adjust the angle based on what angle is appearing, show us what is happening to it and we might be able to help you out. Also, for limiting it, it's as easy as checking if the angle is within the range, and only updating the movieclip rotation when it is.

profile | pm me | sig by bomtumes

BBS Signature

None

Psycho

Reply To Post Reply & Quote

Posted at: 5/11/08 03:48 PM

Psycho EVIL LEVEL 21

Sign-Up: 04/21/06

Posts: 6,456

That's a code you just took from an AS2 tutorial. I know what your problem is, but even a new person to programming would understand it.


None

TomsPulp

Reply To Post Reply & Quote

Posted at: 5/11/08 04:29 PM

TomsPulp LIGHT LEVEL 19

Sign-Up: 01/17/04

Posts: 1,147

ok, heres a pic.

red=registration point
yellow= the area I want the gun/hand to be able to aim at

how can I do that?

Platformer shooter help!

TomsPulp for Icon mod '08!
Message me if you need help on NG.

BBS Signature

All times are Eastern Daylight Time (GMT -4) | Current Time: 09: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!