Page 1 of 5

Online Pong Tutorial

PostPosted: Mon Jan 19, 2004 7:03 am
by trajecto
The stage is set, I just want my paddle to move left and right. What steps do I need to do next?

Here is my stage so far:
http://www.trajectorylabs.com/beta01.gif

PostPosted: Mon Jan 19, 2004 10:41 am
by jazz_e_bob
I see 4 actors.
Each actor will have its own animation.

Background (Infinite Actor)
Ball
Wall
Paddle

PostPosted: Mon Jan 19, 2004 10:42 am
by jazz_e_bob
To launch the ball.

Right Click Ball
Select Actor Control
Add Event
Create Actor
Add Action
Script Editor
Type:
angle = 45;
diretional_velocity = 8;
Click Add
Click Immediate Action
Click Close
Click Close
Click Game Mode and the ball will launch at 45 degrees at 8 pixels per frame.

PostPosted: Mon Jan 19, 2004 10:44 am
by jazz_e_bob
To make the paddle follow the mouse.

Right Click Paddle
Select Actor Control
Add Event
Create Actor
Add Action
Follow Mouse
Click Add
Click Immediate Action
Click Close
Click Close
Click Game Mode and the paddle will now follow the mouse.

PostPosted: Mon Jan 19, 2004 10:46 am
by jazz_e_bob
To make the ball collide and physically respond with everything except for the background.

[anyone? anyone?] :wink: :?:

PostPosted: Mon Jan 19, 2004 12:02 pm
by makslane
Ok....

Set x axis in Follow Mouse action to make paddle with horizontal moves only.


To make ball don't collide with background:

Right Click bakcground

Select Actor Control
Add Event
Create Actor
Add Action
Collision State
Event Actor, disable
Add
Click Immediate Action
Click Close
Click Close

PostPosted: Mon Jan 19, 2004 12:04 pm
by makslane
To make ball moves right:

Right Click ball

Select Actor Control
Add Event
Collision (Any Actor)
Add Action
Physical Response
Add
Click Immediate Action
Click Close
Click Close

PostPosted: Mon Jan 19, 2004 12:07 pm
by makslane

PostPosted: Mon Jan 19, 2004 5:42 pm
by trajecto
Totally amazing guys!

I especially can't believe how nice the collision physical response is. I've seen that done usually with bounding rectangles, but here the ball actually bounces off the rounded ends of the paddle at different angles. Awesome!

I also can't believe Makslane came up with all the images for the project just from my gif. If anybody wants here are my image files and a sound, sorry I should have posted them before:

http://www.trajectorylabs.com/gameEditorFiles.ZIP

This site here has lots of cool free seamless textures for backgrounds:
http://www.noctua-graphics.de/english/freetex_e.htm


I am trying to add a sound now, this doesn't seem to be working, any ideas?:

Right-click ball
Actor Control
Add Events
Collision
Any Actor
Add Action
Script Editor

type:
PlaySound("bink.wav", 1.0, 1);

Add Immediate Action
Close
Close

PostPosted: Mon Jan 19, 2004 6:08 pm
by Just4Fun
Wow!

You guys are amazing. I love creating the simple game graphics but I just can't seem to get my act together when it comes to the actual programming. I do enjoy seeing talent in action though. :lol:

Thanks for the helpful posts...Rachel

PostPosted: Mon Jan 19, 2004 11:09 pm
by makslane
You can add sounds without scripts:

Right-click ball
Actor Control
Add Events
Collision
Any Actor
Add Action
PlaySound (Select your blink.wav)
Add Immediate Action
Close
Close


Note: put your blink.wav file in data directory into .ged file directory and call: PlaySound("data/blink.wav", 1, 1);

PostPosted: Mon Jan 19, 2004 11:25 pm
by trajecto
I got it, that worked great!

PostPosted: Tue Jan 20, 2004 1:05 am
by Just4Fun
I've been working with this tutorial today. Yes! Finally there is a tutorial that I can fully understand. :lol:

My question:

How does one keep the ball, and paddle from going off the stage? or How do you test an object's position in order to keep it within certain boundaries? TIA

PostPosted: Tue Jan 20, 2004 2:21 am
by jazz_e_bob
Assuming the x for your backround = 0.

You can run this script when the paddle actor is drawn:

int range = 75;
if (x > range)
x = range;
if (x < -range)
x = -range;

Changing the value of "range" changes your range. (Obviously ;-) )

PostPosted: Tue Jan 20, 2004 4:40 am
by Just4Fun
jazz_e_bob,

It worked like a charm! I cant believe that something is finally making some sense! A million thanks. Rachel