what's the best way to create rolling terrain with Cocos2D?

Member
Posts: 60
Joined: 2009.06
Post: #1
I'd like to make a side scrolling flying game where the terrain (hills) is generated using mathematical functions .
Has anyone done that and if so, what's the best way to store all that data and to display it in Cocos2D?
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #2
Write your own OpenGL rendering inside of a Cocos2D node's draw method. Unless you want to make a tileset to do it... eww.

Cocos2D's utter lack of state management is pretty frustrating when writing your own rendering functions though.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Moderator
Posts: 916
Joined: 2002.10
Post: #3
I am suspecting you want to duplicate tinywings. See http://www.cocos2d-iphone.org/forum/topic/14136
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #4
Ugh. So much misinformation in that thread. Pixel shaders to procedurally draw a 1D heightmap? Really?

All you need is a triangle strip and a repeating texture. That's how ByteRacer does it: http://howlingmoonsoftware.com/extras.php and it's trivial.

The shading on the hills could be done with simple vertex coloring.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  rolling dice implementation sefiroths 5 6,486 Nov 11, 2010 10:18 AM
Last Post: skyhawk
  Rolling My Own POD Exporter earamsey 2 3,091 May 24, 2009 06:39 AM
Last Post: earamsey