• Home
  • Free Tutorials
  • Free Video Tutorials
Your Ad Here
Adobe Photoshop
Autodesk 3ds Max
CSS
Flash
Help Center Live
iPhone
Joomla
Make Money Online!
Mambo
mIRC
Outlook Express
SEO / SEM
Simple Machine Forum
Target Explorer

Ping Pong - Pause and Scrolling Text

Category : Flash Views : 22509
Version : 8 Rating : 
2.9/5 (40 votes)
  • Currently 2.93/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: ping-pong-pause-scrolling-text.zip
Result: See the result


<<< PreviousIndex SeriesNext >>>

Previous | 1 | 2 | Next

In the tutorial we are going to make the game to pause and display a scrolling text to alert the player that he need to press "P" to continue.

Let's start by making the Movie Clip where the text will scroll. Create a new Movie Clip, like it with the identifier "Scroll".

First thing you need to do is create a mask; a mask represents what is visible inside a Movie Clip. So only what's behind the mask will be seen.
Free Flash Tutorials, Free Flash Game, Ping Pong Game, Pause and Scrolling Text
The square can have any color and size you want.

Now in a new layer write the text that will be scrolling:
Free Flash Tutorials, Free Flash Game, Ping Pong Game, Pause and Scrolling Text
Use static text as we won't be changing in the code.

They should look like this on the first frame:
Free Flash Tutorials, Free Flash Game, Ping Pong Game, Pause and Scrolling Text

Right click the layer of the mask and select "Mask" then drag the text layer below the mask.
Free Flash Tutorials, Free Flash Game, Ping Pong Game, Pause and Scrolling Text

The rest is very simple, just a motion tween. Create a new keyframe on the 90 frame of both layers and on this new frame drag the text to the other side of the mask.
Free Flash Tutorials, Free Flash Game, Ping Pong Game, Pause and Scrolling Text
Right click the frames between the first and the last frame of layer 2 and select "Create Motion Tween". Flash will automatically create two files on your library, "Tween 1" and "Tween 2", because text can't be use directly in a tween animation.

Now go back the main timeline and paste this code:
//variable to see if the game is paused or not var gpause = false; //to know whether the pause key is being pressed or not var keyHold = false; this.onEnterFrame = function() { //if the "p"(code 80 in ascii) is pressed but not holded. if ((Key.isDown(80)) && (!keyHold)) { //set gpause to the contrary of it self gpause = !gpause; //if paused attach the scrolling text at the middle of the screen if(gpause) { _root.attachMovie("Scroll", "Scroll", 10, {_x: 100, _y: 150}); } //if not paused remove the "Scroll" Movie Clip else { _root.Scroll.removeMovieClip(); } //the p key is pressed keyHold = true; } //if the "p" key(80) is not being pressed else if (!Key.isDown(80)) { //then keyPressed is false. keyHold = false; } }


del.icio.us digg it Reddit Stumble Upon Technorati

Previous | 1 | 2 | Next

<<< PreviousIndex SeriesNext >>>
How to Video Tutorials on software by Helpvids.com

Video tutorial: Forex trading



Sponsors



Advertisement







Your Ad Here

Studio | Advertisement | About Webzo | Contact Webzo | Terms of Use | Free Video Tutorials by Helpivds

Copyright © 2007 NR Concepts Ltd. All rights reserved.