Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Putting it in a function is a good idea.

You should open the browser console and see what the error was. That will help you fix it. Really take care and time to read and understand whatever the error is. Pasting the error into a search engine will help. You can find the developer console in the developer tools menu in your browser.

The freeCells array is only available inside the generateMap function. You will need to make it available outside if you want to use it outside, e.g. Game.freeCells = freeCells.

You could then pick a random cell like this: ROT.RNG.getItem(Game.freeCells).

Good luck!

Deleted 2 years ago

If you do console.log(Game.alienfort) immediately after creating it, you will see the position printed. Note that the position is a string like “5x7” not an object like {x: 5, y: 7}.

So in your code where you say makeMonster(Game.alienfort.x + "," + Game.alienfort.y) you probably want to change it to this: makeMonster(Game.alienfort) because the variable is already in the correct x,y string format.

Deleted 2 years ago
Deleted 2 years ago
Deleted 2 years ago

Hey do you want to send me your code and I’ll see if I can debug what is going on. Basically what I’ll do is sprinkle console.log statements throughout the code to check that each variable holds the values I’m expecting them to hold. For example I’ll put some log statements inside monsterAct so I can check why the monster is hitting you but not getting drawn. I suspect it is to do with an undefined/null value somewhere, so I’ll be trying to track that down.

Deleted 2 years ago
(+1)

Hey sorry for the delay. I fixed your bug and moved the conversation to the “questions” section: https://itch.io/post/4901605