skip to main
|
skip to sidebar
It Doesn't Have to DO Anything...
Wednesday, February 17, 2010
I Feel I Have Arrived...
Large version here.
Phew. I'm feeling pretty good. Why is that? Because the above is my first thing ActionScript 3 that I can say I'm pretty happy with! That's right! I have made great strides in AS3 tonight!
I'm all giddy with the possibilities...
As for the coding itself, there's nothing too awfully insane here. We've got a ship that follows the mouse cursor loosely; it does this by moving the distance between itself and the mouse times a fraction of the distance every frame. In other words, if it's 50 pixels from the mouse and we've moving with .5 drag, it will move 25 pixels, then 12.5 pixels, then 6.25 pixels, etc. etc. until it reaches 0.
The bomb is simply a class that initializes with a movement speed on the y axis of -10. Instantly and in every frame, that movement speed increases by .5, giving the illusion of acceleration.
Once the bomb hits, it is removed from the stage and replaced by a shape tweened circle. I manually animated the growth via timeline, but it would be very possible to do so with straight code. That little rainbow flourish you see as the explosion fades is just me playing with code tweens and the ColorTransform object. I simply tween the ColorTransform from a random color to another random color.
There you have it! AS3...I'm warming up to you!
PS:I found this
tutorial
to be incredibly helpful in learning to get classes to speak to one another. Be sure to download the AS3 source code. Interestingly enough, I had my "a-ha moment" with the AS2 version of this tutorial...hmm...they must be doing something right!
1 comment:
Corey
February 17, 2010 at 10:27 PM
This comment has been removed by the author.
Reply
Delete
Replies
Reply
Add comment
Load more...
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
About Me
Corey
Shelbyville, Indiana, United States
I'm a geekish sort of guy by most standards. I absolutely love to read and to play video games. I am a Flash developer currently living in Shelbyville, IN.
View my complete profile
Follow Me
Links
Blog Archive
►
2011
(7)
►
04/24 - 05/01
(1)
►
04/17 - 04/24
(1)
►
03/27 - 04/03
(1)
►
03/20 - 03/27
(1)
►
02/20 - 02/27
(1)
►
01/02 - 01/09
(2)
▼
2010
(50)
►
11/07 - 11/14
(1)
►
06/13 - 06/20
(3)
►
06/06 - 06/13
(1)
►
05/30 - 06/06
(3)
►
05/23 - 05/30
(4)
►
05/16 - 05/23
(3)
►
05/09 - 05/16
(1)
►
05/02 - 05/09
(1)
►
04/25 - 05/02
(2)
►
04/04 - 04/11
(2)
►
03/28 - 04/04
(4)
►
03/14 - 03/21
(1)
►
03/07 - 03/14
(1)
►
02/28 - 03/07
(2)
►
02/21 - 02/28
(2)
▼
02/14 - 02/21
(4)
Wind Redux...Redux...
I Feel I Have Arrived...
8 Points
The Colors!
►
02/07 - 02/14
(2)
►
01/31 - 02/07
(2)
►
01/24 - 01/31
(2)
►
01/17 - 01/24
(1)
►
01/10 - 01/17
(3)
►
01/03 - 01/10
(5)
►
2009
(14)
►
12/27 - 01/03
(2)
►
12/20 - 12/27
(2)
►
12/13 - 12/20
(1)
►
12/06 - 12/13
(1)
►
11/29 - 12/06
(3)
►
11/22 - 11/29
(5)
Followers
This comment has been removed by the author.
ReplyDelete