Be a Supporter!

x/y position of a movie clip.

  • 1,537 Views
  • 43 Replies
New Topic Respond to this Topic
egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to x/y position of a movie clip. Nov. 17th, 2012 @ 11:50 PM Reply

At 11/17/12 10:31 PM, MarijuanaPenguin wrote: Wait, I am confused, how does that get me the x/y coords? I feel like I am missing something really obvious.

that hekps because the bullets are on the same level as everything else, so there's no need for translating, digging around in clips, or parent and whatnot.

At 11/17/12 10:36 PM, MarijuanaPenguin wrote: Actually, better idea. Does anyone know if it is possible to convert rotation to slope? I got everything to work but I need to make the bullets fly in the direction they are rotated. I know this can be done with trigonometry, but since I am in 9th grade, I did not learn that yet. Thanks.

trig is your best option. I got my GED instead of going to 10th grade, and went to Job Corps instead. I still use trig because it's useful.
(by the way, don't drop out. It's a pain to do it, and it's a pain afterword)

x and y to radians:

var rads:Number = Math.atan2(oldY - newY, oldX - newX);

radians to degrees:

var degrees:Number = rads * (180 / Math.PI)

degrees to radians:

var radians:Number = degrees / (180 / Math.PI)

radians to x and y:

var x:Number = Math.cos(rads);
var y:Number = Math.sin(rads);

I have these memorized.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
MarijuanaPenguin
MarijuanaPenguin
  • Member since: Feb. 27, 2011
  • Offline.
Forum Stats
Member
Level 04
Programmer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 12:07 AM Reply

No, but you can convert degrees to radiant and radiant to a vector(not the same kind of vector egg was talking about) by sin and cosing it.

Haven't learned that either, do you know anywhere I can find info on it?

But that won't fix your terribly designed and ultimately broken code.

I got rid of that code completely.


A wise person once said, "In the future, I see you beating your wife in the kitchen, the kitchen of a nice house." - Awesome I am going to be rich! :D

MarijuanaPenguin
MarijuanaPenguin
  • Member since: Feb. 27, 2011
  • Offline.
Forum Stats
Member
Level 04
Programmer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 12:09 AM Reply

Ok, never mind my last post, thanks egg!


A wise person once said, "In the future, I see you beating your wife in the kitchen, the kitchen of a nice house." - Awesome I am going to be rich! :D

MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 12:15 AM Reply

At 11/18/12 12:07 AM, MarijuanaPenguin wrote:
No, but you can convert degrees to radiant and radiant to a vector(not the same kind of vector egg was talking about) by sin and cosing it.
Haven't learned that either, do you know anywhere I can find info on it?

You're just take the easy way out and saying you don't know it, none of those terms even have to do with programming, those are all mathematical. You're not going to get anywhere if you won't take a few second to Google something.


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature
pirateplatypus
pirateplatypus
  • Member since: Sep. 27, 2011
  • Offline.
Forum Stats
Member
Level 15
Programmer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 10:16 AM Reply

At 11/17/12 03:59 PM, egg82 wrote: He doesn't like to cuddle braces, but cuddling is a matter of choice. Personally, I cuddle my braces.

Is my understanding right that cuddling looks like:

public function doStuff():void {
    // code
}

and not cuddling is like:

public function doStuff():void
{
    // code
}

?

If so, I much prefer cuddling my braces. I think it's easier to read.

To the OP, I know the math end of things can sometimes seem a bit daunting, especially if you either haven't learned it, or the last time you used it was well over a decade ago. I'd suggest mathisfun.com. They seem to do a pretty good job of teaching concepts. I'd especially recommend their Sin, cos, and tan explanation.


"If loving Python is crazy then I don't want to be sane." -Diki

MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 12:03 PM Reply

About cuddling, I've pretty much assumed that cuddling is something programmers have adopted from coding in AS2 using back in Flash CS, I don't think I've seen it as a default option in any other editor. I personally find it easier to read uncuddled. In this case cuddled braces is just a random programming practice that's been picked up, such as putting "_root" before things and such. You can't say it's the OPs preference because it's most likely been adopted from AS2 tutorials and requires heavy consideration of the pros and cons before it can be considered a preference.


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature
egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 12:47 PM Reply

At 11/18/12 12:03 PM, MintPaw wrote: About cuddling, I've pretty much assumed that cuddling is something programmers have adopted from coding in AS2 using back in Flash CS, I don't think I've seen it as a default option in any other editor.

Visual Studio, Eclipse, NetBeans, pretty much every editor i've ever used.

I personally find it easier to read uncuddled. In this case cuddled braces is just a random programming practice that's been picked up, such as putting "_root" before things and such.

you act like cuddling is a terrible, horrible monstrosity of a practice that should be banned from coding. Why? Because it's not your preference? You should be a politician.

You can't say it's the OPs preference because it's most likely been adopted from AS2 tutorials and requires heavy consideration of the pros and cons before it can be considered a preference.

there really aren't any "pros and cons" to cuddling. It's like asking "what are the pros and cons of wearing a t-shirt rather than a long-sleeve shirt?"
I dunno, I just like t-shirts better. Just like I like cuddling better.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 12:51 PM Reply

At 11/18/12 12:47 PM, egg82 wrote:
At 11/18/12 12:03 PM, MintPaw wrote: About cuddling, I've pretty much assumed that cuddling is something programmers have adopted from coding in AS2 using back in Flash CS, I don't think I've seen it as a default option in any other editor.
Visual Studio, Eclipse, NetBeans, pretty much every editor i've ever used.

I said default option, not option in general. Just the very fact that there's no easy way to set up cuddling in FD say something in itself.


I personally find it easier to read uncuddled. In this case cuddled braces is just a random programming practice that's been picked up, such as putting "_root" before things and such.
you act like cuddling is a terrible, horrible monstrosity of a practice that should be banned from coding. Why? Because it's not your preference? You should be a politician.

I'm just saying that it can't really be a preference unless you've put some time into thinking about it.

You can't say it's the OPs preference because it's most likely been adopted from AS2 tutorials and requires heavy consideration of the pros and cons before it can be considered a preference.
there really aren't any "pros and cons" to cuddling. It's like asking "what are the pros and cons of wearing a t-shirt rather than a long-sleeve shirt?"
I dunno, I just like t-shirts better. Just like I like cuddling better.

Are you daft? There are obvious advantages and disadvantages to wearing long-sleeve or short-sleeve shirts. . .


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature
egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 12:59 PM Reply

At 11/18/12 12:51 PM, MintPaw wrote: I said default option, not option in general. Just the very fact that there's no easy way to set up cuddling in FD say something in itself.

yeah, I read that again after I posted.

also: Tools->Program Settings->Coding Style Type
not too terribly difficult ;)

I'm just saying that it can't really be a preference unless you've put some time into thinking about it.

Nothing on the politician jibe? Come on, I thought that was good. lol

anyway, what thinking goes into preferences? It's just whatever feels more comfortable to you.

Are you daft? There are obvious advantages and disadvantages to wearing long-sleeve or short-sleeve shirts. . .

it's clothing. Normally I don't give much thought to what I wear. It's whatever's more comfortable to me.
I don't walk around my house in a suit because it's what I see professionals wearing outside theirs.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
MintPaw
MintPaw
  • Member since: Jun. 11, 2006
  • Offline.
Forum Stats
Member
Level 10
Programmer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 01:05 PM Reply

At 11/18/12 12:59 PM, egg82 wrote:
At 11/18/12 12:51 PM, MintPaw wrote: I said default option, not option in general. Just the very fact that there's no easy way to set up cuddling in FD say something in itself.
yeah, I read that again after I posted.

also: Tools->Program Settings->Coding Style Type
not too terribly difficult ;)

You're still wrong originally!


I'm just saying that it can't really be a preference unless you've put some time into thinking about it.
Nothing on the politician jibe? Come on, I thought that was good. lol

I'm taken Philosophy, my professor says that when I say anything that I don't state as a fact. You want to hear the fact version?
Cuddle braces is for people who were born an raised in AS2, it promotes bad formatting due to the braces not being on the same level, it make confusing bundled code and it makes people often forget to write return values, anyone who uses it, considers using it, or ever will use it should be burned for their sins.

anyway, what thinking goes into preferences? It's just whatever feels more comfortable to you.

Are you daft? There are obvious advantages and disadvantages to wearing long-sleeve or short-sleeve shirts. . .
it's clothing. Normally I don't give much thought to what I wear. It's whatever's more comfortable to me.
I don't walk around my house in a suit because it's what I see professionals wearing outside theirs.

I didn't realize this was a fashion discussion, they're different pieces of clothing that do different things, there are pros and cons. . .


If ya have something to say, PM me. I have a lot of time to spare.
Also never PM egg82.

BBS Signature
egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 01:26 PM Reply

At 11/18/12 01:05 PM, MintPaw wrote: You're still wrong originally!

NetBeans, Code::Blocks, bloodshed.
I win :3
(though i'm not sure I should count bloodshed since it doesn't indent anything by default, resulting in a big mess of unformatted code)

I'm taken Philosophy, my professor says that when I say anything that I don't state as a fact.

I like your professor

You want to hear the fact version?
Cuddle braces is for people who were born an raised in AS2, it promotes bad formatting due to the braces not being on the same level, it make confusing bundled code and it makes people often forget to write return values, anyone who uses it, considers using it, or ever will use it should be burned for their sins.

I guarantee ActionScript did not give birth to cuddling braces.

one reference to the age-old debate is here - I did not post this because (spoiler alert) he agrees with cuddling, I posted because it gives a pretty fair weigh-in to both sides.

here's a C/C++ version.

I didn't realize this was a fashion discussion, they're different pieces of clothing that do different things, there are pros and cons. . .

it was a metaphor. It means that just because some (or even most. Hell, it could be all of them, for all I care. it doesn't matter) of the professionals (whatever "professional" means to you) don't cuddle their braces when displaying their code to the public, doesn't mean that i'm going to follow suit because I want to be exactly like them. I'm going to do what I feel is more comfortable to me, and I like to cuddle.
Just like I don't like wearing a suit. In fact, I really don't like wearing a suit. They're itchy.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature
MarijuanaPenguin
MarijuanaPenguin
  • Member since: Feb. 27, 2011
  • Offline.
Forum Stats
Member
Level 04
Programmer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 03:53 PM Reply

pirateplatypus, yea I used that site when I googled it, it's nice.

To everyone else, I leave for two seconds and this turns into a conversation about philosophy? Lol.


A wise person once said, "In the future, I see you beating your wife in the kitchen, the kitchen of a nice house." - Awesome I am going to be rich! :D

milchreis
milchreis
  • Member since: Jan. 11, 2008
  • Offline.
Forum Stats
Member
Level 26
Programmer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 05:55 PM Reply

At 11/18/12 03:53 PM, MarijuanaPenguin wrote: To everyone else, I leave for two seconds and this turns into a conversation about philosophy? Lol.

Please post your most recent status of your problem to overcome the offtopic spam.

egg82
egg82
  • Member since: Jun. 24, 2006
  • Offline.
Forum Stats
Member
Level 05
Game Developer
Response to x/y position of a movie clip. Nov. 18th, 2012 @ 10:58 PM Reply

At 11/18/12 05:55 PM, milchreis wrote: Please post your most recent status of your problem to overcome the offtopic spam.

Chill, we're just bored. The forum hasn't seen much action lately.


Programming stuffs (tutorials and extras)
PM me (instead of MintPaw) if you're confuzzled.
thank Skaren for the sig :P

BBS Signature