2D Platform collision with spline and a matrix ?

Monkey Archive Forums/Monkey Discussion/2D Platform collision with spline and a matrix ?

GC-Martijn(Posted 2011) [#1]

I'm trying to make a 2d platform game, but I don't know the best way to make a nice 'spline' road (or jumping place).

At the moment I only have the simple 2d Matrix 32x32 array map, but that is to simple for my game.

To illustrate what I want see this


How is this made ? and is it easy ?

The thing is it don't listen to the simple 32x32 (block map) matrix collision.

Is it possible to make one big image mask, you can walk ?

Thanks for the info.

Shinkiro1(Posted 2011) [#2]
The only way I can think of is that you check your objects against the bottom line:

The bottom line would be a polygon and your objects could be polygons, circles or squares which you check against.
Maybe this can help you: http://www.monkeycoder.co.nz/Community/posts.php?topic=353

GC-Martijn(Posted 2011) [#3]
mmm, you say make 3 layers
- big image for the game
- one for the player
- one with polygons

So I can make a picture in for example photoshop, and then I make a hidden polygon map.

I was thinking about a mask but that din't work very well yet.
Going to try this way now.

JIM(Posted 2011) [#4]
You should make a basic editor for your collisions. That way you can trace your polygons around your objects optimally (for example surround 2 overlapping objects with the same polygon).

You need the polygon map because the computations are a lot simpler on polygons than they are on a mask.

Good luck :)

AdamRedwoods(Posted 2011) [#5]
A bezier curve would be difficult:

An array of points that make up a polygon mask would be simpler:

As mentioned above, you could need to make an editor so you can create your points and put them into an array, or...

You can also try using Illustrator/Inkscape or another vector program to trace your polygon mask (no curves) and export an SVG text file to get the list of points. (Work in the upper left corner to get 0,0 positioning.)

GC-Martijn(Posted 2011) [#6]
Thanks for all the info, at the moment I'm using the Adobe Illustrator demo to make the game as one big picture.

When I have the big picture I will export all the lines like AdamRedwoods say :) (the lines where the collision will happen)

Ofcourse I will split the image in some small sectors to for example 500x500.
And make a extra layer for jumping platforms and powerups etc.

If this works it will be very cool, because you can make the full game in illustrator !

AdamRedwoods(Posted 2011) [#7]
FXG file format outputs better readable coordinates than the SVG output from Illustrator.