Community

Cool Little Trick I figured out.

Posted Jul 28, '08 at 10:28pm

Klaushouse

Klaushouse

1,612 posts

Iron - Lord

I am pretty sure the price range of 1500 to 7000 is a bit off. If not then holy crap sponsorship and a new wii here I come. I will check it out.

 

Posted Jul 28, '08 at 10:28pm

Programpro

Programpro

303 posts

Wood - Knight

lol cool.

Friends, Klaus?

 

Posted Jul 28, '08 at 10:32pm

Klaushouse

Klaushouse

1,612 posts

Iron - Lord

Yes I have friends Program...
...
...

...
...

...
...

...
...

...
...

...
...
Not but seriously sure friend it up.

 

Posted Jul 28, '08 at 10:37pm

Programpro

Programpro

303 posts

Wood - Knight

I can't tell if you were joking or not...

If not I meant do you want to be friends?

If so I'm pretty sure "friend it up" means yes...lol

 

Posted Jul 28, '08 at 11:04pm

Klaushouse

Klaushouse

1,612 posts

Iron - Lord

Yes friend it up is indeed an acceptance of friendship and an invitation to click my very royal Add Friend button.

 

Posted Jul 29, '08 at 2:24pm

Programpro

Programpro

303 posts

Wood - Knight

lol...

Also, I realized what you meant and I went ahead and changed my code. Now, instead of flipping the image when the mouse is to the left, it changes the rotation so it's facing the correct way. With it, I coded a little missile to follow my mouse (it was kewl).

But, yeah, is that the weaknesss in my code you were referring to?

 

Posted Jul 29, '08 at 4:19pm

Klaushouse

Klaushouse

1,612 posts

Iron - Lord

Sounds good. And by a missile following your mouse I presume all you did is have an MC with the missile MC inside and on the actions of the missile MC all you need is this._x += 5; looping the entire time and have the parent MC rotating and the missile follows. :D

Code sounds better program.

 

Posted Jul 29, '08 at 4:40pm

Programpro

Programpro

303 posts

Wood - Knight

No, actually this is waaaaay better. The missile is a standalone MC, and the code:

this._x += Math.cos(this._rotation*(Math.PI / 180)) * 10
this._y += Math.sin(this._rotation*(Math.PI / 180)) * 10

Coupled with the "Point at Mouse" code moves it perfectly! (The PI thing is to convert from degrees to radians).

So, yah.

 

Posted Jul 31, '08 at 12:07am

Whichello

Whichello

4 posts

Iron - Serf

its better if u do this

player.onEnterFrame = function(){
this._rotation=Math.atan2(_ymouse-this._y,_xmouse-this_x)/(Math.PI/180)
}

thats off the top of my head but it should work

 

Posted Jul 31, '08 at 12:11am

Whichello

Whichello

4 posts

Iron - Serf

player.onEnterFrame = function(){
this._rotation=Math.atan2(_ymouse-this._y,_xmouse-this._x)/(Math.PI/180)
this._x = _xmouse
this._y = _ymouse
}
this is better soz

 
Reply to Cool Little Trick I figured out.

You must be logged in to post a reply!