Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Questions & support Sticky

A topic by chr15m created Aug 19, 2020 Views: 650 Replies: 21
Viewing posts 1 to 9
Developer

If you have a question about how to use the boilerplate, please post it here.

Are the pixel graphics scaled? Can I insert higher resolution art without needing to change anything, or would I be limited to small pixel art assets?

Developer

Yes they are scaled using a CSS transform, and you can adjust the scaling factor. High resolution art should be fine, and I’m happy to help you get it working.

(1 edit)

I don't think renderStats() is working for me. Every time I take damage or pick up coins the stats doesn't get re-rendered

I fixed it. I just ended up putting renderStats when I take the damage because it was only calling every time I pick up the coins

Developer

Nice work, glad you got it working! The renderStats function must be called every time you update the stats.

Unreleated question but do you have hints/tips on how to get damage numbers to appear on screen like shown in Asterogue? 

Developer

Yes what you can do is create a new div on the same position, similar to the way the ghost is created.

You should make sure you have a blank tile in the tilemap and assign it to the space character like “ “. Then you can create the empty sprite and put a number inside it:

const number = createJuiceSprite([p._x, p._y], " ", "float-up");
number.innerHTML = "23";

That should create a number 23 which floats up and then disappears.

I'm going through the pdf to try and add more  monsters and it says to add them into an array; which when I console.log it originally, it looks like It goes into an array but when I do this; the game breaks:  while I can move the game doesn't really do anything and I can't see the monster that  I added to the array

thoughts?



Developer

Hey, I think this is happening because you are pushing an array in there not the actual object.

Change this:

game.monsters.push([createBeing(makeMonster, freeCells)]);

To this:

game.monsters.push(createBeing(makeMonster, freeCells));

Removing the square brackets will just push the one monster into the monsters array.

Ahh thanks! That works; I was close lol. Your boilerplate is great I'm using it for Game Off 2021. Might continue to make more games with this once I become more familiar with rot.js

Developer

No problem, I’m glad it’s useful.

Developer(+1)

Debugging @MisterAtompunk’s monster issue.

@MisterAtompunk was adding a new monster when the old monster died. What happened was an invisible monster was created that hit the player every move. I suspected the issue would be an error with the monster’s position. I added some console.log() statements and I saw this output:

5,4,undefined

The undefined value printed there tells me there is an issue. Two variable are printed: _x and _y and it looks like "5,4" is being set to the first variable, and the second is undefined.

If you look at the makeMonster(x, y) function you can see it accepts two arguments, one for x and one for y, whereas the old code was doing this: makeMonster(Game.alienfort) which can never work because it’s only passing in the one argument (a string with “x,y”).

The fix is to get the x and y values separately out. So I changed his code to this (line 850) and it fixed the issue:

  const pos = posFromKey(Game.alienfort);
  const m = makeMonster(pos[0], pos[1]);

Always check the “arity” of your functions to make sure the arguments going in match what is expected. Using console.log() is a useful way to see if variables hold the value you expect.

Thank you so much for taking the time to look over my mess. Your solution fixed it right up and I am waist deep in alien spawns now! Thank you for all your help and patience.

Developer

No worries, great to hear it’s working.

Hello Chris! I just purchased your roguelike and I seems to have a bug with hit points damage. I also noticed that I don't get the updated version. Do I have to re-purchase to get it? Maybe, cuz, of the work. Or am I entitled to the lastest version or up coming versions??? I loved you hand drawn animated sprites you posted. I would like to talk to you about future goals if you got the time? Thanks Love your poroggie just the same!

Developer

Hi Scott. Can you please tell me more about the hit points bug? What are you seeing versus what you expect? Please feel free to share your code.

In terms of updates, any up.date will be available to you. You’re entitled to all future updates. I will post here next time I release an update.

The hit points are not registering.  The do not change when a monster hits me. I love your proggie and I really do wish I had an updated version. I see one on itch.io but do I have to buy it right after I just bought the first one???

You'll need to call the renderStats() function whenever you want to update the stats displayed in the stats box at the bottom of the game screen. The template has a line under "Player" section that calls the renderStats(); function when a coin is moved on by the player character. To update the hitpoint stat during combat you'll need to add renderStats(); somewhere in your "Combat" section, like after an attack. You can also add it near the end of the "Player" section when the player moves to update every time the player takes a step.

Developer

Please see MisterAtompunk’s reply about rendering the stat updates. You do not have to buy any update. All the updates come with the original purchase.

Got it working! Thanks for the help! I guess I don't know the coding of it all that well yet anyways. Is there more docs besides the .pdf???

Hello out there! Happy Valintine's! Everyone! Chris, I was wonding if you could show me how to add more monsters to my roguelike? I read the .pdf and it says you'll need to add an array list and categorize monsters and pick from there.  Is there a way you could show me how to do that I am not really great at coding in JavaScript I use mostly other languages but I am willing to learn.  

I was going to write my own rogue but I thought it would be nice to learn how to operate this one and utilize it more.

Developer

Hello Scott_Bro_1, and sorry for the slow reply. There is some example code in the other questions on this board that you can follow. Basically you have to change Game.monster to be Game.monsters which should be a JavaScript array like []. Then add new monsters to that array like in this example:

https://itch.io/post/4901482

Good luck.