Online Pong Tutorial

Non-platform specific questions.

Online Pong Tutorial

Postby trajecto » Mon Jan 19, 2004 7:03 am

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
User avatar
trajecto
 
Posts: 86
Joined: Fri Jan 16, 2004 3:12 pm
Location: Michigan, US
Score: 6 Give a positive score

Postby jazz_e_bob » Mon Jan 19, 2004 10:41 am

I see 4 actors.
Each actor will have its own animation.

Background (Infinite Actor)
Ball
Wall
Paddle
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby jazz_e_bob » Mon Jan 19, 2004 10:42 am

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.
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby jazz_e_bob » Mon Jan 19, 2004 10:44 am

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.
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby jazz_e_bob » Mon Jan 19, 2004 10:46 am

To make the ball collide and physically respond with everything except for the background.

[anyone? anyone?] :wink: :?:
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby makslane » Mon Jan 19, 2004 12:02 pm

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
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby makslane » Mon Jan 19, 2004 12:04 pm

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
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby makslane » Mon Jan 19, 2004 12:07 pm

makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby trajecto » Mon Jan 19, 2004 5:42 pm

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
User avatar
trajecto
 
Posts: 86
Joined: Fri Jan 16, 2004 3:12 pm
Location: Michigan, US
Score: 6 Give a positive score

Postby Just4Fun » Mon Jan 19, 2004 6:08 pm

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
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby makslane » Mon Jan 19, 2004 11:09 pm

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);
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Postby trajecto » Mon Jan 19, 2004 11:25 pm

I got it, that worked great!
User avatar
trajecto
 
Posts: 86
Joined: Fri Jan 16, 2004 3:12 pm
Location: Michigan, US
Score: 6 Give a positive score

Postby Just4Fun » Tue Jan 20, 2004 1:05 am

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
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby jazz_e_bob » Tue Jan 20, 2004 2:21 am

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 ;-) )
Controlling complexity is the essence of computer programming.
User avatar
jazz_e_bob
 
Posts: 742
Joined: Tue Jul 01, 2003 9:38 pm
Location: Bloke from Cockatoo Creek Australia
Score: 14 Give a positive score

Postby Just4Fun » Tue Jan 20, 2004 4:40 am

jazz_e_bob,

It worked like a charm! I cant believe that something is finally making some sense! A million thanks. Rachel
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest