Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Game Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-30-2011, 12:52 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 30
Anonymous Username is on a distinguished road
Default Terraria, Blocks That Matter, Battle Block theater, and junk jack can all do this...

So I'm building a very basic platformer right now its a green square moving around in a world of orange square. Every time I make a new square I have to manually code so it works with the rest of the world. In all the games in the title they somehow wrote a way to say when you hit this type of block it stops you from falling, or it kills you, or it sets you on fire... I don't even know how this is done, is it a subview class? or something like that...
Anonymous Username is offline   Reply With Quote
Old 01-03-2012, 10:16 AM   #2 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 17
jdunehew is on a distinguished road
Default

Quote:
Originally Posted by Anonymous Username View Post
So I'm building a very basic platformer right now its a green square moving around in a world of orange square. Every time I make a new square I have to manually code so it works with the rest of the world. In all the games in the title they somehow wrote a way to say when you hit this type of block it stops you from falling, or it kills you, or it sets you on fire... I don't even know how this is done, is it a subview class? or something like that...
Collision detection
jdunehew is offline   Reply With Quote
Old 01-03-2012, 09:16 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 30
Anonymous Username is on a distinguished road
Default

Quote:
Originally Posted by jdunehew View Post
Collision detection
Dude if you going to reply to the post at all please write more than two words. The problems isn't whatever you ment by collision detection, I was asking how games like terraria or junk jack know when your touching a certain type of block, because dirt blocks drop dirt and stone blocks drop stone. In the platformer I've been making I have to code each block and it seems more like it would efficient to be able to code types of blocks instead of every individual block.
Anonymous Username is offline   Reply With Quote
Old 01-04-2012, 10:26 AM   #4 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 112
RoryHarvey is on a distinguished road
Default

Have a superclass "Block" then have "DirtBlock", "GrassBlock" etc inherit it.
RoryHarvey is offline   Reply With Quote
Old 01-07-2012, 12:08 PM   #5 (permalink)
Registered Member
iPhone Dev SDK Supporter
 
smasher's Avatar
 
Join Date: Jul 2008
Location: San Mateo, CA (San Fran)
Posts: 3,858
smasher will become famous soon enough
Default

You want your level to be data, not code.

You store the blocks in some kind of data structure, like a 2d array of pointers. Then you can ask questions like "give me the block in front of the player" and then call methods like [theBlock giveRewardTo: player].

Depending on the type of the block, the player would get a different reward.

Going from code-driven to data-driven is a big step, so it'll be confusing at first. It's how "real" game are written, though.
__________________

Free Games!
smasher is offline   Reply With Quote
Old 01-10-2012, 05:36 PM   #6 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 30
Anonymous Username is on a distinguished road
Default

Quote:
Originally Posted by smasher View Post
You want your level to be data, not code.

You store the blocks in some kind of data structure, like a 2d array of pointers. Then you can ask questions like "give me the block in front of the player" and then call methods like [theBlock giveRewardTo: player].

Depending on the type of the block, the player would get a different reward.

Going from code-driven to data-driven is a big step, so it'll be confusing at first. It's how "real" game are written, though.
Could you point me in the right direction to learn more about this?
Anonymous Username is offline   Reply With Quote
Old 01-10-2012, 06:00 PM   #7 (permalink)
Registered Member
 
Join Date: Nov 2011
Posts: 30
Anonymous Username is on a distinguished road
Default

Quote:
Originally Posted by smasher View Post
You want your level to be data, not code.

You store the blocks in some kind of data structure, like a 2d array of pointers. Then you can ask questions like "give me the block in front of the player" and then call methods like [theBlock giveRewardTo: player].

Depending on the type of the block, the player would get a different reward.

Going from code-driven to data-driven is a big step, so it'll be confusing at first. It's how "real" game are written, though.
whoosps i double posted
Anonymous Username is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 384
9 members and 375 guests
apatsufas, comicool, Creativ, dansparrow, husthlj, LunarMoon, mer10, Murphy, pbart
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,677
Threads: 94,127
Posts: 402,916
Top Poster: BrianSlick (7,990)
Welcome to our newest member, husthlj
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 07:04 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0