Question about the Pong Template

For questions about using Classic.

Post » Sun May 17, 2009 7:45 pm

I am trying to tweak Pong template to get some experience on Construct.

I got some problems on Pong.

1- When the two bars are at the middle, and when the game begins the ball should hit to exactly middle of the bars. It should go 0 to 180 degree angles like a line. Instead of this, It goes random and finally goes out. I put the ball and the bars to the middle of screen, but didn't change.

2- When the ball goes out and adds the score, readytext becomes visible and ball comes to the center, as in the event sheet editor. But, when we hit start, ball continues to its last path. Instead of this, it should have start with a 0 degree (if player 2 wins) or with a 180 degree (if player 1 wins) angle. How can I do such a thing? I tried "change angle" but it changes the angle of picture, not the movement path.

3- How can we create an event something like "if (ball == destroyed) { ball = atthecenter; }". I see there are some conditiouns like "is visible", "on collision with another object", but I didn't see a "is destroyed" condition. Is there a method to do such thing?

4- Is there an easy method to create a "theme" feature? I get an idea something like creating objects for each theme like Bat1a for first theme, Bat1b for second theme, Bat1c for third theme... etc, and when the user selects a theme (for example the second theme), program would assign every object for the theme (for example Bat1 = Bat1b, Bat2 = Bat2b, Ball = Ball2b...). But it seems a bit long way. So I wonder if there is an easier way for this.

Thanks for any help and ideas.
B
2
G
3
Posts: 18
Reputation: 886

Post » Sun May 17, 2009 8:33 pm

[quote="Bonecrusher":8tcv97sh]1- When the two bars are at the middle, and when the game begins the ball should hit to exactly middle of the bars. It should go 0 to 180 degree angles like a line. Instead of this, It goes random and finally goes out. I put the ball and the bars to the middle of screen, but didn't change.[/quote:8tcv97sh]

Set the Ball randomness to 0 in the behavior properties. It will still be a little, tiny bit random. Not much you can do about that.

[quote:8tcv97sh]2- When the ball goes out and adds the score, readytext becomes visible and ball comes to the center, as in the event sheet editor. But, when we hit start, ball continues to its last path. Instead of this, it should have start with a 0 degree (if player 2 wins) or with a 180 degree (if player 1 wins) angle. How can I do such a thing? I tried "change angle" but it changes the angle of picture, not the movement path.[/quote:8tcv97sh]

When creating an action for the Ball, switch to the Ball Behavior tab in the New Action window. You will find the Ball Behavior action "Set angle of motion."

[quote:8tcv97sh]3- How can we create an event something like "if (ball == destroyed) { ball = atthecenter; }". I see there are some conditiouns like "is visible", "on collision with another object", but I didn't see a "is destroyed" condition. Is there a method to do such thing?[/quote:8tcv97sh]

Use the System condition "Compare" against the number of balls:

[code:8tcv97sh]System: Compare: Ball.Count Equal to 0[/code:8tcv97sh]

.Count is an expression that you can use for just about any layout object.

To create a new ball when the old one is destroyed, you can use the System action "Create object."

[quote:8tcv97sh]4- Is there an easy method to create a "theme" feature? I get an idea something like creating objects for each theme like Bat1a for first theme, Bat1b for second theme, Bat1c for third theme... etc, and when the user selects a theme (for example the second theme), program would assign every object for the theme (for example Bat1 = Bat1b, Bat2 = Bat2b, Ball = Ball2b...). But it seems a bit long way. So I wonder if there is an easier way for this.[/quote:8tcv97sh]

Make each part of your theme a different frame in it's sprite animation. So when you change to Wood theme or Metal theme or whatever, set all of your game object's animation frames to the corresponding theme.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun May 17, 2009 8:46 pm

ok thanks, will look at them.
B
2
G
3
Posts: 18
Reputation: 886


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests