Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by Jeremy

I have a couple areas in my map that features an incline for a character to walk up. Not sure if this is in Impact Engine ( was unable to find the feature ). But how would I a make such a thing possible. I haven't started going into how I would create sloped tiles I figured I would ask if anyone else has a solution to this first.

1 decade ago by KZeni

I'm also interested in this.

The ideal situation that I can come up with is having collision tiles that abide by the alpha channel of the collision tile used (ie. Vehicle 2 has a backdrop and a collision layer), but it would have to account for the steepness of the slope so that movement over that tile doesn't look strange & items with a bounce coefficient could be rather difficult & what if someone wants to use curved slopes...

All of this being said; I haven't been able to look into this subject for myself, because my primary computer is away for repairs.

1 decade ago by ape

I've been doing a lot of research and trial and error work with sloped tiles recently. I haven't been able to get something I'm satisfied with yet, but I feel like I'm getting closer.

I've been using Entities to represent sloped tiles. This seems to be working but I have to do a lot of interesting things to the Player entity when it hits a sloped tile to make it "feel" right (like turn off gravity and velocity and manually adjust Player's position using a Bresingham's line algorithm, then turn it all back on when the Player has moved beyond the slope).

I think it&039;d be ideal if entities could have #collision: ig.Entity.COLLIDES.SLOPE with slope: {x1: 0, y1: 0, x2: 32, y2: 32} as a settable property (which would describe a 45 degree slope). Impact's Entity class could then use the entity's slope setting to figure out how to handle velocity, bounciness, and a new one: trajectory.

That said, I may dig into the collision code to see how this might work. But I recognize that it's complicated.

Some links to stuff I've been reading (all of which may be basic comp sci, physics 101 stuff, but all new to me):

velocity, friction, inclined planes
Bresenham's line
more line stuff
collisions with slopes

1 decade ago by jminor

Here is some Flixel code for sloped tiles that might be helpful:

https://github.com/fefranca/FlxUtils/blob/master/com/fefranca/flixel/FlxTilemapSloped.as

Demo here: http://www.fefranca.com/experiments/flxslopes/

1 decade ago by nikki

I know I'm digging up a really old thread, but if anyone is still looking for a way to make curved or sloped tiles, maybe this will help? http://nicolahibbert.com/curved-sloped-tiles-javascript-games/

I'll post some code for Impact as and when I get it implemented into my game.

Cheers! :)

1 decade ago by MyShuitings

That's a clever approach, I'm currently working on a top down that needs fancy lighting effects like the player has a torch etc. So I've been playing with modifying the alpha levels of background tiles.... this is a clever implementation for the collision level. I'd be interested to see how you approach it.

1 decade ago by Hareesun

@MyShuitings - Me too! :P Hope we're not working on the same game ;)

1 decade ago by MyShuitings

@Hareesun - nah... I doubt it... I'm working on a straight up faithful to the original clone of Zelda Link to the Past for the SNES. The ides is to use it to develope a tone of awesome code, without worrying about or being limited by my creativity. Things like the lighting affect of the lantern and torches in the dungeons etc, the pathfinding of the badguys, inventory systems etc... Kinda a proof of concept that we can all take browser games to the next level.

Then I'll do something creative of my own I suppose.

1 decade ago by Hareesun

PHEW. :P

We're safe... For now. ;) Sounds awesome though! Can't wait to see it :)

1 decade ago by axphin

A great read overall (although it is older and uses Flash)

Here is the chapter on slopes which may provide some helpful info.
http://www.tonypa.pri.ee/tbw/tut24.html

1 decade ago by Nennad

I am interested also in advanced collision detection, be it by alpha chanell tile-based, or by drawing kind of vector mask inside a editor, perhaps ? Probably will eat more resources, but would be nice to have more complex tileset and perpixel collision!

1 decade ago by Hareesun

This can basically be done already by having a specific collision tile assigned to diagonal movement. It just needs to push the player up and in the direction walking.

I plan on prototyping this idea soon. I’ll post with progress.

1 decade ago by stahlmanDesign

Normally, each tile is either completely solid, or intangible. But each tile could optionally access an array that gives more precise collision detection within that tile. In Weltmeister, imagine that among your collision tiles in the collision layer you have a few slopes. These could call the additional slope code.

/><br />
<br />
When a sloped tile is encountered in the game world, check the array to determine the collision detection inside the tile.<br />
<br />
By looping through the array starting at the top left, you move down pixel-by-pixel searching for a solid pixel in each column. <br />
<br />
If the entity.pos.x is at column X, allow it to fall only to the row where the solid pixel was detected.<br />
<br />
Upon collision detection while moving sideways, allow the entity to be pushed up (walk up slope).<br />
<br />
If you have 20 tile images in your map, you may only need a few special collision arrays, such as a sloping left and right, and one or two «rugged» arrays. The rest can be either completely solid or free (current default behaviour).<br />
<br />
Many different graphics with a slope may use the same slope array.<br />
<br />
These arrays must be coded ahead of tile, but there will likely only be a few, depending on the resolution of your tiles. It may be simpler to do it this way than to check for alpha pixels.			</div>
		</div>
	
	
<div class= Page 1 of 1
« first « previous next › last »