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.

2D All the way! / Show only what you see

Author
Message
Bluedeep
21
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Finland
Posted: 24th Mar 2003 09:35
I have 2d rpg and i want to do so that player don´t see what is behind wall.
I think it´s very hard to do that, but if anyone know how to do that, then tell me, i´v be pleased. [b])
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 24th Mar 2003 11:38
Hmm, try thinking along the lines of what order you render the player and wall. I haven't tested this but you might want to do something like:



That's Psuedo Code by the way so it won't work in Dark BASIC, it's just a 'theory' in code. But yeah, check to see if it's within the wall's dimensions, if it is then render the wall AFTER the player so it's on top of it. Otherwise Render the wall first.

Hope you understand what I'm talking about, I haven't done too much 2d work recently so there could well and truly be an easier way. I'm not sure.

"Computers are useless they can only give you answers."
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 24th Mar 2003 11:43
Alternatively you could build into your level editor the order in which you render things. A game I wrote in VB a long time ago used a 'layer' system, you would put objects onto the first layer like grass and the ground which would render first. The second layer would have buildings and trees which would render second. The third layer would have windows (for the buildings) and fruit (on the tree) that would render last. You could easily increase the number of layers to how many you want. Just an idea.

"Computers are useless they can only give you answers."
Bluedeep
21
Years of Service
User Offline
Joined: 3rd Feb 2003
Location: Finland
Posted: 8th Apr 2003 14:48
Maybe my last post was unclier because i suck in english, sorry.
i think that player/character words mixtup [b])
i mean that when player see´s area like 20x20(tiledisplayed)
so i want all tiles that character dont´t see(like square behind wall) to be shown black. i need somekind of algoryhtm for that. please

Login to post a reply

Server time is: 2024-04-20 15:04:12
Your offset time is: 2024-04-20 15:04:12