Question about the Pong Template

This forum is currently in read-only mode.
From the Asset Store
Fruit Slicer Template & Quality fruit and slice graphics (c3p,png,illustrator files)
  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

    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.

    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?

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

    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.
    
    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.
  • ok thanks, will look at them.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)