Forum Topic: Actionscript help

(73 views • 6 replies)

This topic is 1 page long.

<< < > >>
Angry

fallensoul289

Reply To Post Reply & Quote

Posted at: 10/1/09 11:25 AM

fallensoul289 EVIL LEVEL 18

Sign-Up: 09/11/07

Posts: 1,082

Ok so I am doing a turret defense game but I need my turret to only move up and down to a certain point. I have this code:

onClipEvent (enterFrame) {
myRadians = Math.atan2(_root._ymouse-this._y, _root._xmouse-this._x);
myDegrees = Math.round((myRadians*180/Math.PI));
_root.yChange = Math.round(_root._ymouse-this._y);
_root.xChange = Math.round(_root._xmouse-this._x);
_root.yMove = Math.round(_root.yChange/20);
_root.xMove = Math.round(_root.xChange/20);
this._rotation = myDegrees+90;
}

The problem is it rotates I need it only to move up and down to a certain point. Kind of like heli invasion. But I was thinking I should only use a code that uses the Y axis but I have no clue. Anyone want to steer me in the right direction?

|Add me on XBL| My flash's|Thanks to SupraAddict for the awesome sig!

BBS Signature

None

Yambanshee

Reply To Post Reply & Quote

Posted at: 10/1/09 12:11 PM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,587

Steer you in the right direction? using the _rotation value.

If you copy code like that (dont pretend like you didint) and expect people to help you, or give you code your expecting alot. Nobody is going to make your game for you, you have to do it yourself.

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

None

fallensoul289

Reply To Post Reply & Quote

Posted at: 10/1/09 12:25 PM

fallensoul289 EVIL LEVEL 18

Sign-Up: 09/11/07

Posts: 1,082

At 10/1/09 12:11 PM, Yambanshee wrote: Steer you in the right direction? using the _rotation value.

If you copy code like that (dont pretend like you didint) and expect people to help you, or give you code your expecting alot. Nobody is going to make your game for you, you have to do it yourself.

Hmm well then sure I copied that code because I never have delt with that kind before. I did not just give out the code I also said i think I need to only use the y axis. Instead of using big boy words and trying to look cool why don't you just not post at all if your not going to help. Also I have made games look at my profile but those used completely different types of coding. Also there is nothing wrong with getting help. Only narrow minded people refuse help. So please get the hell out of this thread if you don't have anything helpful to say.

|Add me on XBL| My flash's|Thanks to SupraAddict for the awesome sig!

BBS Signature

None

Hi5er

Reply To Post Reply & Quote

Posted at: 10/1/09 12:26 PM

Hi5er LIGHT LEVEL 08

Sign-Up: 05/14/07

Posts: 90

At 10/1/09 12:11 PM, Yambanshee wrote: Steer you in the right direction? using the _rotation value.

If you copy code like that (dont pretend like you didint) and expect people to help you, or give you code your expecting alot. Nobody is going to make your game for you, you have to do it yourself.

Kinda harsh.

Isnt this place created for people to get help?

Sorry mate but I have no clue I just work on full rotation, you could maybe try editing your code and take out all the x's? :P

But I seriously have no idea either :l

I Will Stop posting When I Reach 100 Posts. Enjoy Me While You Can


None

fallensoul289

Reply To Post Reply & Quote

Posted at: 10/1/09 12:37 PM

fallensoul289 EVIL LEVEL 18

Sign-Up: 09/11/07

Posts: 1,082

Yeah I tried that and it did not work but thanks anyways man it's good to see that some people are willing to help. No sweat for now I will just work on the art for it and see if I can use some c++ as code and see if the debugger will steer me in the right direction

|Add me on XBL| My flash's|Thanks to SupraAddict for the awesome sig!

BBS Signature

None

Yambanshee

Reply To Post Reply & Quote

Posted at: 10/1/09 01:29 PM

Yambanshee DARK LEVEL 11

Sign-Up: 10/05/08

Posts: 1,587

ok, ill push you into the right direction. put this in your code somewhere
trace(this._rotation);

AS2||AS3||Motox
Thanks to hdxmike for the sig :]

BBS Signature

None

UnknownFury

Reply To Post Reply & Quote

Posted at: 10/1/09 02:01 PM

UnknownFury EVIL LEVEL 26

Sign-Up: 08/10/05

Posts: 6,027

Firstly, get rid of all the rounding; it serves no purpose. Secondly, restrict the _rotation by something like:

if(_rotation > max) _rotation = max;

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


All times are Eastern Standard Time (GMT -5) | Current Time: 06:37 AM

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