Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Developer
GoldenJoe
Posts: 342
Registered: ‎09-28-2009
My Device: Not Specified

Actionscript Game Effects

Greetings!

 

I've got a nice simple actionscript game going, and I'd like to polish it up before I submit it to the app world. Thing is, I'm not sure how to do various animations and effects. For now, these are the most important ones to me. As always, thanks so much for your help.

 

Menu Transitions

I'm still not sure how to make different "screens" (I'm an actionscript noob, so I'm picking it up as I go along). Suppose I have a title screen. How could I make it transition nicely into the game (fading, 3D flipping, making the components fly away, etc)?

 

Round 1

A banner runs across the screen, then some text ("Round X") runs across the banner, pauses in the middle then runs off to the side, after which the banner dissipates. Some combination of timers and transformations? Can you use tweens in Flex Builder like that?

 

Glowing Trail

There are some balls moving around in the game. I'd like it if I could give them an afterimage effect as they bounce around. Think something like the light trails from the bikes in tron, except not permanent. It must be able to follow the ball at any angle, including bounces. How could I make the edges of the trail "glowy" and have the tip fade out? Sorry for the ASCII art, I can photoshop an example later if it isn't clear. The "O" is the ball, the lines are glowing edges, and the space in between is a low alpha color.

   _____

O_____

 

 

Distorted Grid

How can I distort parts of an image and have it return to normal? If you've ever played Geometry Wars, you may have noticed that the background ripples for large explosions. I'd like to produce something similar.

 

Rolling Score Counter

I'd like to make the numbers in the score counter roll, sort of like an odometer. Not necessarily a 3D wheel, but more like the new number fades in and translates from above while the current number does the opposite. Is there any kind of neat way to do this with text, do should I just go ahead and make it using bitmaps?

Developer
kdittyr
Posts: 278
Registered: ‎10-27-2010
My Device: Playbook

Re: Actionscript Game Effects

Hi there, GoldenJoe.  You will be able to do many of the effects that you are looking for with Tweener.  You should look for Tweener tutorials and play around with some tests to get the look and effect you are going for.

 

Here is a video on youtube that might help you out a little:

Using Tweener API

 

That video is about a year old, but should still be usefull to you.

 

Good luck with your development.

--------------
kdittyr

Accepted PlayBook Applications:
HDB Converter -- Utilities/Calculators
Developer
jffurlan
Posts: 1,003
Registered: ‎01-16-2011
My Device: PlayBook (sim)

Re: Actionscript Game Effects

For any screens I was switching to and from I used Tweener as well. Mind you I'm not loading a game, however it worked well move containers, lists, etc around the screen and I would think if you had both your title screen and game as two separate childs you could simply tween from one to the other.

 

For the title of each round (IE round 1) you can easily add an eventListener for when the game starts that adds the child off screen, tweens it to the middle, adds an eventListener for EventComplete, then tweens it off stage after a delay. (from there I would add a third eventListener to removeChild as well).

 

Hope this helps a bit!

- If you like my response/post, or it helped you find an answer you were looking for, please provide a Kudo - white star to the bottom right of this post. -
- Please use the search bar at the top, or check out the PlayBook FAQ's for help getting started -
- Hockey DrillBook -
Developer
GoldenJoe
Posts: 342
Registered: ‎09-28-2009
My Device: Not Specified

Re: Actionscript Game Effects

Thanks for the suggestions, guys. I'll check that Tweener class out shortly. How about the afterimage and grid distortion? Those ones seem a bit more difficult to tackle...not sure where to start.

Developer
jffurlan
Posts: 1,003
Registered: ‎01-16-2011
My Device: PlayBook (sim)

Re: Actionscript Game Effects

I have to admit that even the idea of making a game is way beyond my knowledge of Actionscript (and coding in general) so I can't really help there.

 

As for your grid distortion question, not sure if this helps, but it might:

http://www.flashmonkey.co.uk/colorwall/

(assuming that is what you're trying to achieve).

- If you like my response/post, or it helped you find an answer you were looking for, please provide a Kudo - white star to the bottom right of this post. -
- Please use the search bar at the top, or check out the PlayBook FAQ's for help getting started -
- Hockey DrillBook -
Developer
GoldenJoe
Posts: 342
Registered: ‎09-28-2009
My Device: Not Specified

Re: Actionscript Game Effects

Good find on the grid. I think I can modify that into looking pretty close to the effect I have in mind. This is a very simple game, so details like that don't have to be perfect. Now I just need to figure out the glow trail.

 

As for game development, I'm new to Actionscript too, but I've done games before. It's not that dissimilar from developing games in J2ME...nicer in alot of ways, actually. I wouldn't mind writing a simple game tutorial for the PlayBook or BlackBerry in general, but first I need to see what the final SDK is like since that is likely to become the "real" way to make games for this thing.

Developer
RottenOgre
Posts: 274
Registered: ‎11-01-2010
My Device: PlayBook?

Re: Actionscript Game Effects

Keep in mind that AS3 itself has been around for a long time, and been used for plenty of games, so chances are somebody's already done whatever you want to do.

 

In this case for the glow effect you have two options. You can use built-in glow filters (e.g. something like this -it's AS2 but there's an AS3 version in the comments) or you can just make an image yourself externally (e.g. photoshop) and then constantly create new images and have them follow your object and slowly lose opacity and when they hit 0 opacity kill them.

 

e.g. very roughly, have this going in an EnterFrame event:

 

var glowTrail:smileyfrustrated:omeImage = new SomeImage();

addChild(glowTrail);

glowTrail.x = objectYouWantToFollow.x;

glowTrail.y = objectYouWantToFollow.y;

 

 

and then for the SomeImage EnterFrame:

 

this.opacity -= 5;

if(this.opacity <= 0)

{

MovieClip(this.parent).removeChild(this);

}

 

Or something to that effect. Play around with it. Probably better to do it the second way as filters (espically moving) are very expensive.