User Tag List

Results 1 to 8 of 8

Thread: Pong for one player....

  1. #1
    Clicker Fusion 2.5SWF Export Module
    videogiochi's Avatar
    Join Date
    Jun 2010
    Location
    italy
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pong for one player....

    Hello everyone.
    I'm working on a variation of PONG.
    I made the version for two players, all went well.
    But now, I want to implement the single player version.
    Who can help me for the movement of the computer player?
    Is there a step by step tutorial that can enlighten me?
    Do you think a neophyte I can do?

    Alex (Italy)

  2. #2
    Clicker Fusion 2.5SWF Export Module
    videogiochi's Avatar
    Join Date
    Jun 2010
    Location
    italy
    Posts
    152
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pong for one player....

    please, help me!

  3. #3
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Pong for one player....

    Just make sure the computer moves the paddle towards the ball at the same speed the player is capable of.
    Working as fast as I can on Fusion 3

  4. #4
    No Products Registered

    Join Date
    Dec 2008
    Location
    U.S.
    Posts
    133
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pong for one player....

    if (Ball.X>Paddle.
    {
    Paddle.X=Paddle.x-Paddle.Speed
    }
    else if (Ball.X<Paddle.
    {
    Paddle.X=Paddle.x+Paddle.Speed
    }

  5. #5
    Clicker Fusion 2.5 Developer

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,321
    Mentioned
    15 Post(s)
    Tagged
    0 Thread(s)

    Re: Pong for one player....

    That's okay for super-easy difficulty, but the AI will struggle if the ball is bouncing around a lot.

    What you *should* do is make it so that every time the ball hits the player's paddle, you run a fastloop to simulate the movement of the ball. That way, the AI can instantly and accurately predict the point where the ball will reach their edge of the screen (instead of just following the ball up and down).

    I made this example a long time ago:
    http://cid-b1e7ee094271bbda.office.live.com/self.aspx/Public/pong.mfa
    (you may need to update MMF2, as it uses the ATan2 function)

  6. #6
    Clicker Multimedia Fusion 2 DeveloperiOS Export ModuleSWF Export ModuleUnicode Add-on

    Join Date
    Jun 2006
    Location
    Australia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pong for one player....

    MuddyMole - That AI is awesome

  7. #7
    Clicker Fusion 2.5 Mac
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Sep 2008
    Location
    Western Australia
    Posts
    256
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Pong for one player....

    Quote Originally Posted by MuddyMole
    What you *should* do is make it so that every time the ball hits the player's paddle, you run a fastloop to simulate the movement of the ball.
    I don't know if the following idea would work, but maybe give it some thought...

    Instead of calculating the movement of the ball, could you have an invisible 'shadow' ball that always mimics the real ball, and when the player hits the ball, the 'shadow' ball is speeded up until it reaches the X coordinate of the CPU bat; you would then know the Y coordinate of where the real ball was heading.

    I haven't really thought it through, but wonder if it might be an option.

  8. #8
    Clickteam Clickteam
    LB's Avatar
    Join Date
    Jun 2007
    Location
    Richardson, Texas, North America
    Posts
    8,937
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Re: Pong for one player....

    That's the same thing except that it wastes memory by having another object...
    Working as fast as I can on Fusion 3

Similar Threads

  1. Ping Pong
    By Looki in forum Released Extensions
    Replies: 11
    Last Post: 31st December 2013, 12:50 PM
  2. Simple Pong Example
    By RickyRombo in forum File Archive
    Replies: 0
    Last Post: 22nd January 2010, 06:58 PM
  3. The ball... (in pong)
    By RickyRombo in forum Lacewing
    Replies: 3
    Last Post: 20th April 2009, 01:26 AM
  4. Pong A.I.
    By sam_sdc in forum Multimedia Fusion 2 - Technical Support
    Replies: 4
    Last Post: 6th February 2009, 11:10 PM
  5. Help with pong...
    By blehman in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 21st December 2007, 01:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •