Infinite Jumper mechanics queries

Get help using Construct 2

Post » Thu Apr 25, 2013 1:53 pm

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!! . 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
B
15
S
4
G
1
Posts: 4
Reputation: 1,476

Post » Thu Apr 25, 2013 4:36 pm

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
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

Post » Fri Apr 26, 2013 12:34 pm

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?
B
15
S
4
G
1
Posts: 4
Reputation: 1,476

Post » Fri Apr 26, 2013 11:52 pm

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
B
28
S
8
G
1
Posts: 469
Reputation: 4,683


Return to How do I....?

Who is online

Users browsing this forum: Justin1967, Nifl and 21 guests