Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Code Snippets / [DBC] 2D Heightmap type thingy

Author
Message
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 15th Jan 2008 00:44
I have no idea if this is of any use at all but...


TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 15th Jan 2008 15:47
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 15th Jan 2008 19:05 Edited at: 15th Jan 2008 19:06
thanks TDK
was wondering where to put this

The idea was that you could make a platform game with detailed landscapes. It works a bit like voxels do in 3D, although I don't know if it actually works yet

Profit
18
Years of Service
User Offline
Joined: 19th Feb 2006
Location: United States
Posted: 15th Jan 2008 21:07 Edited at: 16th Jan 2008 06:21
This is my take on it. I messed up the colors a little bit. It should work in DBC...



Edit: If are using DBC, or don't have IanM's plugins, add this to end:



Thanks BiggAdd!
common people are walking in line.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 16th Jan 2008 04:50


Profit
18
Years of Service
User Offline
Joined: 19th Feb 2006
Location: United States
Posted: 16th Jan 2008 06:08 Edited at: 16th Jan 2008 06:22

Just realized 'clamp' is from a plugin... added a function for clamp, added character movement (similar to yours+jumping), and made it so terrain is not constantly changing (although it could. Just remember to call 'redrawTerrain' after changing heightmap).


Thanks BiggAdd!
common people are walking in line.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 17th Jan 2008 23:17
That's pretty cool
I edited it a bit so it works in DBC


Profit
18
Years of Service
User Offline
Joined: 19th Feb 2006
Location: United States
Posted: 18th Jan 2008 02:47 Edited at: 18th Jan 2008 02:49
I tried the version you posted and the color was screwed up. For you, does it go (bottom to top) green, brown, white? (When I said I messed up the colors in my first post, I just meant that it'd only be white if the height was 240 aka top of the screen)
Are colors handled differently in DBC?


Thanks BiggAdd!
common people are walking in line.
Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 22nd Jan 2008 20:28
that's strange I didn't do anything to the colours except pass them as floats (you can't declare as float in DBC), the hill is green fading to yellow at the peak.

Login to post a reply

Server time is: 2024-11-22 13:38:20
Your offset time is: 2024-11-22 13:38:20