Pong: How to have ball stick to paddle and launch when left click of mouse

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I've been playing w/MMF Dev on and off for a bit (not nearly enough) and I'm having some difficulty in doing something that shouldn't be too hard, but I'm not sure how to code it. In this game, when the ball leaves the bottom of the screen, i would like a life to be lost and the ball to "stick" to the paddle and launch again once a user clicks the mouse. Can someome help me out with what i'm missing.Please login to see this attachment.

  • Well done.

    - First thing I did: I Change the movement type of paddle from [mouse controlled] to [static], the mouse controlled it's not the best choice and was allowing to move the paddle in Y direction too.

    - I created a condition: AWAYS>[hide mouse pointer] and [set X position of paddle to XMouse]. This event will aways set the paddle to mouse coordinate X.

    - I created a Alterable String called [moving] in BALL object.

    - When the ball leaves the play area on the bottom, I add this action: Set Alterable String [moving] to "no".

    - I created a condition: Alterable String [moving] = "no" THEN Set position of ball to position of paddle.

    - I created a condition: User clicks with left button AND Alterable String [moving] = "no" THEN set Alterable String [moving] to "yes"


    There a lot of ways to this that you are trying....I made in this way.....hope you enjoy.....is attached.....

  • If I remember correctly has a tutorial of pong in tutorials area of the site....and if you go in HELP in the top of you multimedia fusion then click TUTORIALS you will find the chocobreak tutorials.....its a pong game....

    Please login to see this link.

  • i did choco break when i first purchased mmf, and today i was doing a tutorial from Karen Collins on PONG. I was trying to go out on my own and do a modification, but i didn't know how to do what i wanted. I'm about to load up your version now. Thanks, rubes

  • Thanks PaoBrasil, this was very helpful. I completely understand what you are doing and why, which was easy since you spelled it out clearly. I have since modified it to use arrow keys, and to check for collisions on the walls by the paddle, to keep that in the game play. I realize this is a simple exercise, but it is invaluable for learning the concepts. Eventually I'll add the bricks and turn this into a breakout type game.

    What is the recommended way for doing different brick setups? I'm thinking a different frame for each new brick configuration, but in reading the boards, i know people do a lot with arrays and level editors, though i'll need to work up to that, if that is the recommended approach.

  • Level editor is definitely a route you could go.
    That would mean you only have to use one frame for all the levels.

    Basically you build a simple level editor where you can place the bricks and then save the brick x and y positions and what kind of bricks they are to an array or file.

    Then you can go for a value that determines the level and load said data accordingly at the frame start.

    Check out Nivrams page which is full of useful examples of all kind if you haven't already.


    Btw. what you are trying to do sounds more like arkanoid than pong ;)

  • Blub, this is more arkanoid than pong, but it's all a learning experience, and before there was arkanoid there was breakout, and before breakout, there was pong. I've spent a lot of time reading the forums and reading tutorials, but not as much time actually using the product. I've got the day off, and its way too hot here to even go outside, so I'm puttering away. I know i've seen some discussions on level editors, so once i figure out a few things, I'll work my way to that

  • I've tried to run a tutorial on Level Editors from Marv's site (great resource) but it requires the ini++ plugin. I've downloaded and installed it, but having issues with this being recognized as the example still says i need to have the plug in. I think i'll do a few different levels with frames, just to get some other concepts down. Nothing earth shattering happening here, just learning the ropes

  • Blub, Nivram and Popcorn, you guys are awesome. I'm at work now, so i don't have access to mmf, and just before leaving this morning, i heard a big bang and lost all my power (it's been hot in minneapolis lately and i think that may have something to do with this). hopefully i have power when i get home, and will look at these examples then. I completely comprehend the WHY part of doing a level editor instead of frames, let's hope i can wrap my head around the how portion.

  • Popcorn, you've got a very well done demo there. I've run it and read through it, modified it and it all make sense to me. I'm not saying i could create this from scratch, but this gives me a great model and with some repetition, i will be able to replicate this. Time for me to play around now

  • Yeah, you need to get rid of the quotes around yes in the alterable string. When you code, you use quotes to tell mmf that this is a string, but when you type it in the alterable string in the frame editor, the quotes will be part of the string.
    Also, add 'only one action when event loops' in the event that creates the level.

    And an advice, don't use the mouse-movement if you don't really have to. Instead use static movement and code the it in the eventeditor by setting x = xmouse and y = ymouse.

    Other than that it seemed nice :)

  • OK, i'm coming along here. That bit about the quotes is invaluable. I'd be pulling my hairs out without that one.

    Which line are you talking about for this one?
    Also, add 'only one action when event loops' in the event that creates the level.

    I know everyone is down on the mouse movement, and i'll address that in the future, with another one of your tutorials on fast loops so i can set the speed and have perfect collision detection :) I've got the printout of that to my left

  • You have:
    * LevelCleared of paddle = "yes"
    - Start loop "ReadRow"

    This event will start the loop all the time as long as LevelCleared of paddle = "yes". If you add a 'only one action when event loops' condition below it, it will make the even run only once, since you don't want it to keep making the level over and over again.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!