阅读背景:

将位置映射到数组索引

来源:互联网 

Backstory: I'm making a simple maze game, where the maze is procedurally generated. I represent the maze as a 2D array of rooms, with 4 booleans storing whether or not each corner of a room has a wall. (if Room.south_wall == false, than the room is connected to the room to its south.) Each room and can have an arbitrary length and width. For simplicity's sake, I set it so that the length and width is determined at the beginning of generation and applied to all rooms. The position of the player is stored using 2 floats, one is their x coordinates, one is their y coordinates. The maze looks something like this (Thick black lines are the visible walls, thin red lines represent the 2d array):Backstory: I'm making a simple maze game, where




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: