Bounce and jumpthru

0 favourites
  • 5 posts
From the Asset Store
Bouncing ball
$9.99 USD
Template for a bouncing ball game, fully documented in comments and video
  • Hey guys I have been using the bounce behaviour that comes with the bullet behaviour but when I try to make a platform and have it bounce on to that it just goes right thru. I read the manual and it says to use the platform behaviour with the jumpthru but then my bounce doesn't work. How can I make my ball bounce and have it go jumpthru the platform and then bounce again on that platform. I have been trying to figure it out for the last 5 hours I think it time to ask for help. Thanks guys :)

  • You can create a solid platform and move it out of the way when the bullet hits it from below, and then move it back in place when the bullet has moved above it. Not perfect, but works pretty well. There are comments that should explain, but if you have questions, just ask!

    bouncybullet.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • works pretty well thanks a lot. So now that I have that figured out Im stuck again on the next part lol. Im trying to make a doodle jump clone I can't get random platforms to appear above the window. I have the scroll to behaviour set so he can be followed by the camera and the unbounded set to yes. I have some platforms on the layer already to start having it bounce on something and some platforms above the window size and it does reach there but when i tell the system to create object at random(20,580) for x and -25 for y they never get created. Can someone help me out please.

  • It sounds like you are creating the platforms outside the LAYOUT, not outside the current VIEW (or as you say, window), so they will never appear. Remember that x and y refer to the location on the layout, and a -y value will be above the layout (which is useful if you have an object you want to fall into the layout.)

    To make an object just above the current view, you need to take into account the current position of the view. From the manual system expressions section:

    scrollx

    scrolly

    Get the current position the view is centered on.

    Try this:

    create object solidPlatform on layer 0 at (random(scrollx-(windowwidth/2),scrollx+(windowwidth/2)), scrolly-(windowheight/2))

    It will create the platform just below the top of the current view so that you can see it. To understand this, you need to know that

    Scrollx-windowwidth/2 is the position of the left edge of the view. scrollx+windowwidth/2 is the position of the right edge of the view.

    scrolly-windowheight/2 is the position of the top edge of the view.

    scrolly+windowheight/2 is the position of the bottom edge of the view.

    Knowing that, you can make adjustments to the locations by adding or subtracting margins as below:

    create object solidPlatform on layer 0 at (random(scrollx-(windowwidth/2-leftMargin),scrollx+(windowwidth/2-rightMargin)), scrolly-(windowheight/2-topMargin))

    where you might set variables leftMargin=20, rightMargin=20 and topMargin=-25

  • Thanks a lot for your responses they are very appreciated :)

    I have been playing around with what you gave me the whole day!!and they are being created but not in the right position I read the manual and if i understand it correctly

    scrollx

    scrolly

    Get the current position the view is centered on.

    and the

    The Scroll To behavior

    simply centers the view on the object with the behavior

    From your formula

    (random(scrollx-(windowwidth/2-leftMargin),scrollx+(windowwidth/2-rightMargin)), scrolly-(windowheight/2-topMargin))

    Since I have given the the scroll to behavior to my character that means the position of my character is equal to scrollx and scrolly (going from the logic of the manuel)

    But what this does is if i have my character on lets say x=20

    that would give me a random value starting in the negatives which means the platform is being created out side my window size sometimes. (just to be clear by window Im refering to area that is always visible when the game is running -so for example the screen size of a phone. I set this under Window Size in the project settings)

    I find a lot of the settings with construct are not very flexible or at least they dont appear to be (im also new to this so maybe that is why)

    I have read all the relevant parts in the manual that say anything about the windowsize I was wondering if your able to change its position relative to the layer. Every time i make the layer bigger it adds to the width and height from the top down and left to right. which i think is kinda weird.

    Having my character wrap is also not working im not sure how turn off the top and bottem wrapping when he jumps above the point where he is to wrap around (I thought this was supposed to be outside the window [the layout is the same size as the window]) but he is never out that so im not sure how he is jumping above that. I turned that off and set the bound to layout behaviour but now he reaches close to the top and is stopped so that wont work either. Im thinking this might be caused by the "scroll to" not keeping up with him fast enough ?? I dontknow . Making a doodle jump game is turning out to be harder than i thought lol. O well i think its fun :) thanks for your help again and sorry to keep bothering you believe me i have been reading the manuel and lookign in the forums first.

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