This tutorial will explain how to make a complete "Pong against Computer" game in SwishMax. SwishMax, a major improvement over Swish 2, includes SwishScript (Flash users know it as "ActionScript" which is almost the same.) which will allow us to code this game which wasn't possible in Swish 2.
1) Start
SwishMax (obviously, you need to do that step)
2) In the Movie Panel, set the width (
600px) and the height (
400px) of the movie.
- You also need to put the movie frame rate. The human eye can only see up to 25 frames per second so there's no need to put it higher unless you want your movie to go faster. Using a low frame rate (12 for exemple) will make your movie animations not look "smooth". Using 20 fps is perfect for this project. Also, make sure that your settings are set to "Variable frame rate" or your movie will lag sometimes to be perfectly ajusted with the time. Do not check "Stop at the end of the movie" or the Enterframe script won't work unless a "return to frame 1" script.
3) The next step is to create all the objects needed for our game. The list and description are below this image.
-
ball :: A circle with the name "ball" and must be targeted. (Check the Target box)
-
left :: A line on the left called "left" and must be targeted.
-
right :: A line on the right called "right" and must be targeted.
-
top :: A line on the top called "top" and must be targeted.
-
bottom :: A line on the bottom called "bottom" and must be targeted.
-
user_pal :: A rectangle positionned in the middle (vertically) of "bottom", called "user_pal" and must be targeted.
-
top_pal :: A rectangle positionned in the middle (vertically) of "top", called "top_pal" and must be targeted.
Be sure not to make the edges of the rectangles near the bottom or top lines or it can creates a bug if the ball enter the side of the rectangle and the lines at the same time.