kafk Posted April 6, 2013 Author Share Posted April 6, 2013 probably from a large number of questions in my last topic immediately lost the desire to help ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png)now interested in this:how to make a one great location, but it is necessary that the player could only see part of where it is located within the walls.As an example - a player moved from one room to another - he sees within the limits of this room Link to comment Share on other sites More sharing options...
kafk Posted April 6, 2013 Author Share Posted April 6, 2013 up. help somebody. think, its not hard for you Link to comment Share on other sites More sharing options...
unnown Posted April 6, 2013 Share Posted April 6, 2013 simply sad, use the source, add an attribute to each tile, like roof (this has been made before TE i think donnow)and if player is within a tile with that attribute only blit tiles that have that attribute. Link to comment Share on other sites More sharing options...
cjsrch Posted April 6, 2013 Share Posted April 6, 2013 Im working on this now.. only shows parts that would actualy be vis from where you stand so its based on true location and just just a section. its turning to be really cpu heavy so if i can cut it down ill release it..currently at the phase of using php ( i know it better) for proof of concept… so dont expect anything soon. Link to comment Share on other sites More sharing options...
unnown Posted April 6, 2013 Share Posted April 6, 2013 my way should be easy enough ^.^bit hard to code maybe, but just pm me with problems if needed Link to comment Share on other sites More sharing options...
cjsrch Posted April 6, 2013 Share Posted April 6, 2013 Your way does sound easy. After you said that i started to think of having a new layer that has tile dataeach tile gets assigned a area number then a string of areanumbers viewable from itso if you are in a room your tile says all tiles numbered 1 are ok to show.. as you walk to a corner it would say all tiles numbers 1 and 2 are ok to show soit would open up tiles around the corner ….Would be easy and much less cpu intensive then my way..find screen size ( mine has multiple sizes) exmpl (10x10)divide x and y tiles displayed by two (5x5)make ratios using those numbers all combos in that range (-5:-5 1:5 -1:5 and so on)start at player position and using each ratio move out from player untill it hits a block once it hits a block mark all tiles beyond that layer as black.see crappy example herehttp://justprof.it/test.phpSample of code if it helps any one with an idea``` ".$x." ".$y."";$xf=$tx+$x;while(($ty<=$ym ) AND($ty>=0) AND ($tx<=$xm ) AND($tx>=0) ){if($tx==$xf){$ty=$ty+$y;$xf=$xf+$x;}echo " x".$tx."y".$ty."b".$block;if($block>=1){if($mapprint[$tx][$ty]==1){}else{$mapprint[$tx][$ty]=2;}}if($map[$tx][$ty]==1){$block=1;}if($x!=0){$tx=$tx+($x/abs($x));}else{$tx=$xm+1;}}/////////$x=$x+1;}$x=0-$qx;$y=$y+1;}////////////////////$mapprint[$playerlocx][$playerlocy]=5;$x=0;$y=0;?>=1){if($mapprint[$x][$y]==1){echo "O";}else{echo "x";}}else{echo ".....";}?> |``` Link to comment Share on other sites More sharing options...
dimx Posted April 11, 2013 Share Posted April 11, 2013 I think what you want to do is setup a camera. This Camera is going to be fixed on the players location so if the player moves the camera also moves. Then based on that camera you want to only render the objects inside the camera. You can adjust the camera size based on the window size.I will give you a little pseudo code of the top of my head.```For Y = 0 To CameraHeight / TileSize For X = 0 To CameraWidth / TileSize Check If camera is out of maps bound. If so exit Get the tile info from the map array for the x and y tile position based on your current camera x and y Set the tile attributes and texture based on the information from above. Render tile based on the X and Y position of the camera. NextNext```Of course you will have to add camera movement somewhere with your player movement so that when the player moves his camera moves with him. Link to comment Share on other sites More sharing options...
Link Posted April 11, 2013 Share Posted April 11, 2013 > I think what you want to do is setup a camera. This Camera is going to be fixed on the players location so if the player moves the camera also moves. Then based on that camera you want to only render the objects inside the camera. You can adjust the camera size based on the window size.> > I will give you a little pseudo code of the top of my head.> > ```> > For Y = 0 To CameraHeight / TileSize> > For X = 0 To CameraWidth / TileSize> > Check If camera is out of maps bound. If so exit> > Get the tile info from the map array for the x and y tile position based on your current camera x and y> > Set the tile attributes and texture based on the information from above.> > Render tile based on the X and Y position of the camera.> > Next> > Next> ```> > Of course you will have to add camera movement somewhere with your player movement so that when the player moves his camera moves with him.To expand on his snippet..Edit: So you want it where you don't have to switch to maps, but you can rather walk from map to map? Multi map rendering, I'm working on that right now. I'll post what I can for you tomorrow. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now