123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|68|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Off Topic -> Slopes

Sat, 14 Jun 2014, 06:01
spinal
Argh!!! slopes!!!
Sat, 14 Jun 2014, 06:01
Jayenkai
Indeed! Note how often I've used slopes!!
Sat, 14 Jun 2014, 06:04
spinal
I have a 2 tile slope (32*16) I can walk up the first tile, but once I get to the second pixel of the second tile I bounce up in the air for no reason! ARGH!
I may have to redo my whole collision detection from scratch...

-=-=-
Check out my excellent homepage!
Sat, 14 Jun 2014, 06:12
Jayenkai
Bouncy slopes!!!

FloorHeight=top-(x/2) or something.. Been a long time since I bothered!!

It was MUCH easier with proper pixel-based collision detection. You could keep the player falling until the player reached the tile in question..

-=-=-
''Load, Next List!''
Sat, 14 Jun 2014, 14:49
spinal
ARGH!!!!!!



I've been literally fighting with that code ALL DAY!!!!!
basically tiles 145 and 146 make a 32*16 slope, im trying to walk up it, that's it! FirstFloorTile is a few higher, so under previous iterations the player would just walk in front of the slope tiles.

What in the name of all things sane and logical am I doing wrong?

-=-=-
Check out my excellent homepage!
Sat, 14 Jun 2014, 15:47
Jayenkai
Random shot in the dark, could it be to do with the "playerY+7" bit? As soon as it pushes the player up to tileheight+8, then playerY+7 would be looking at the wrong tile, wouldn't it??
Suggest analysing more than the immediately beneath tile. Scan the current location, the one beneath, and the one below that, then try to work out whether you're in the right place.

Recently I've opted for 2 sets of co-ordinates per player/enemy/etc.
You have your X,Y co-ordinates, tile based, so 3,5 would be the 3rd tile across, and 5th down..
Then I have OffsetX and OffsetY, which are floats.
When you move left, you do OffsetX-0.1, then when you hit <-0.5, do OffsetX+1 and X-1

When drawing, draw at (x+OffsetX)*tilesize

Doing it that way ensures that you always have a int-based grid reference, and can easily do checks like "if offset>-0.25"

-=-=-
''Load, Next List!''
Sun, 15 Jun 2014, 12:44
Dabz
There is an article kicking about about platformers... someone put it over at the bb.com forums... good read, really recommend you search for it because its got the lot!

Dabz

-=-=-
Intel Core i5 6400 2.7GHz, NVIDIA GeForce GTX 1070 (8GB), 8Gig DDR4 RAM, 256GB SSD, 1TB HDD, Windows 10 64bit
Sun, 15 Jun 2014, 19:31
therevillsgames
I think this is the one Dabz is thinking about:
https://www.gamedev.net/page/resources/_/technical/game-programming/the-guide-to-implementing-2d-platformers-r2936
Mon, 16 Jun 2014, 16:47
Dabz
That's the fella!

Top stuff

Dabz
Wed, 18 Jun 2014, 13:37
spinal
AAAAAAAAAAAAAAAAAAAARRRRRRRRRRRRRRRRRRGGGGGGGGGGGGGGHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!

-=-=-
Check out my excellent homepage!
Fri, 20 Jun 2014, 11:19
spinal
Right, switching image handles to top left, all this centre malarkey is throwing my maths off.

-=-=-
Check out my excellent homepage!
Mon, 23 Jun 2014, 01:56
spinal
Never ever ever let me loose this code!!!!




-=-=-
Check out my excellent homepage!
Mon, 23 Jun 2014, 05:04
Jayenkai
Congrats on getting it working (hopefully )
Can't wait to see Joe running along slanted lines! 'tis a strange new world he's heading to!

-=-=-
''Load, Next List!''
Mon, 23 Jun 2014, 14:46
spinal
tweaked a little to remove the 'snap' on landing from a jump


-=-=-
Check out my excellent homepage!
Mon, 23 Jun 2014, 21:10
therevillsgames
Whats with all the magic numbers?

What is the slope1 and slope2 arrays?
Tue, 24 Jun 2014, 00:24
spinal
mostly random crap for debugging. Slope1 and slope2 are heights for each column of pixels within the two slanted tiles.

i never thought id have this much trouble doing ramps without just grabbing the pixels from the screen

-=-=-
Check out my excellent homepage!
Tue, 24 Jun 2014, 19:32
therevillsgames
So at the moment you only have two incline of slopes?

With the magic numbers I was talking about this kind of coding:


I guess 8 and 16 are the centre of the player sprite? It's better if you set a variable for these so you can alter the size of your sprites in the future.
Wed, 25 Jun 2014, 03:03
spinal
8=center, 16=feet, yeah.
resize my sprites!!!!! are you serious!!!!!???!
Joe is 16x16 and always will be (in the near future anyway), he's 16bit don't you know!

-=-=-
Check out my excellent homepage!