Infinite Jumper mechanics queries

  • Howdy peeps,

    I'm a C2 novice (like, ghost shooter and jungle platformer graduate novice!) and have decided the best way for me to get to grips with some more of the functionality is to try and make some simple games that I already play. That way I don't have to think too hard about designing game mechanics, just implementing them!

    So I've decided Game 1 is going to be Doodle Jump - don't laugh, it passes the time on the train!! <img src="smileys/smiley1.gif" border="0" align="middle" />. On the face of it, it seems a pretty straightforward game and I've found the Infinite Jumper demo so that's given me a start but I've found myself struggling with how to prevent new platforms being created too close to eachother - Doodle Jump always has them spaced at least a platform height apart.

    If you've seen the code in the Infinite Jumper demo, you'll see that platforms are created fairly well spaced from eachother. To get closer to the Doodle Jump appearance though, I've increased the number of platforms created each cycle but now occasionally a couple will be created really close to eachother. I'm fine if they touch cos I've just added a collision check but is there a way to create something like a 'proximity' check?

    e.g. "If Instance A is within 20px of Instance B > Destroy Instance B (or move it away maybe?)"

    Any advice would be greatly appreciated!

    Cheers

    FF

  • A way to differentiate between two instances of the same object would be to use a family with just that one object in.. i like to do it so that if the object is called 'platform', create a family called 'platform2'

    that way you can do

    +if platform is within 20px of platform2

    destroy platform 2.. or move or whatever

    You'll probably need to fiddle with other filtering of instances.. so that it only applies to the platforms just created for example. but im not sure the context its in so i cant give a definite asnwer

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks Keepee. That's a nice way of doing it. I think distinguishing between platforms/instances is straight-forward enough, it's the 'is within 20px' bit that I'm really struggling with. Is there a function I've missed that allows you to do this?

  • a few ways to do 'is within 20px' along just the X axis would be:

    system compare two values | abs(platform.x-platform2.x) is less than 20

    or

    system is inbetween values | platform2.x-20 < platform.x > platform2.x+20

    but like i said, filtering could be a little awkward depending on your context.

    also if you use username itll notify them directly! i only saw this reply by chance

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