Skip to content
This repository has been archived by the owner on Dec 5, 2020. It is now read-only.

Commit

Permalink
Fixed some line breaks
Browse files Browse the repository at this point in the history
  • Loading branch information
mtancoigne committed May 25, 2016
1 parent eeca370 commit 5d7cc1a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This is a work in progress around map generation and [this article](http://web.a
- [ ] Creating pathes between rooms
- [ ] Place random objects
- [x] Render with jQuery

## Demo
For now, there is a [codepen](http://codepen.io/mtancoigne/pen/mPZeRQ) as a demo. It may be out of sync, but i'll try to keep it up...

Expand All @@ -26,6 +27,7 @@ The map generator creates arrays of data and functions to work with. The _map_ i
['wall', 'wall', 'wall', 'wall', 'wall']
]
```

At this stage, there are floors and walls, but any _cell_ type should be handled in the future.


Expand All @@ -52,8 +54,10 @@ To include the generator in a webpage, simply load the script `js/mapgen.js` and
map.jQueryRender('#destination');
</script>
```

#### MapGen options
The class can be created with optionnal options. If you don't use one, a default value will be used.

```js
// Options and their default values
var options={
Expand Down Expand Up @@ -120,9 +124,11 @@ function(x, y, passes, cleanLevel, wallPercent, sameSubCellPercent){}
*/
this.createMapFromSample=function(sample){}
```

Some samples are present in `js/room_samples.js`. This method is meant to replace `createMap()`. You should not use `removeSmallRooms()` too, as it will modify your sample.

A typical use will be:

```js
var sample = [] // The sample

Expand All @@ -133,6 +139,7 @@ map.createRooms();
```

### createRooms

```js
/**
Finds all the rooms in the map and fills this.rooms and this.cellsData.
Expand All @@ -141,16 +148,19 @@ this.createRooms=function(){}
```

### removeSmallRooms

```js
/**
Remove really small rooms
@param int minSize - Minimum size for a room to be kept.
*/
this.removeSmallRooms=function(minSize){}
```

This must be called after `createRooms()`.

### jQueryRender

```js
/**
Renders the map using jquery in the given target.
Expand All @@ -165,6 +175,7 @@ this.jQueryRender=function(target, prefix){}

### grid
It's an array representing rows and cells like :

```js
var grid=[
['wall', 'wall', 'wall', 'wall', 'wall'], // Row 1
Expand All @@ -174,10 +185,12 @@ var grid=[
['wall', 'wall', 'wall', 'wall', 'wall'], // Row 5
]
```

For now, there are two types of cells, but this should be extendable in the future.

### rooms
It's the list of rooms created by `createRooms`.

```js
var rooms=[
{
Expand Down Expand Up @@ -210,6 +223,7 @@ var rooms=[

### cellsData
List of cells and their corresponding Id. This is created by `createRooms`.

```js
var cellsData={
"1:34":0,
Expand Down

0 comments on commit 5d7cc1a

Please sign in to comment.