roguelike-tutorial | Following along with The Complete Roguelike Tutorial | Genomics library
kandi X-RAY | roguelike-tutorial Summary
kandi X-RAY | roguelike-tutorial Summary
At r/roguelikedev we're doing a dev-along following The Complete Roguelike Tutorial.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of roguelike-tutorial
roguelike-tutorial Key Features
roguelike-tutorial Examples and Code Snippets
Community Discussions
Trending Discussions on roguelike-tutorial
QUESTION
I'm making a toy roguelike and have a Level
structure for storing the game map, for which the most naive implementation is a 2D vector.
I'm following this tutorial which uses a Vector
of Vector
s, but states that for performance gains it's also possible to use a single Vector
of size MAP_HEIGHT * MAP_WIDTH
, and to access a tile at (x, y)
one can simply access map[y * MAP_WIDTH + x]
.
I'm trying to implement this faster method but using getters and setters is clunky, and public fields aren't that great either. I'd much prefer it to feel like a 2D vector.
In order to do that I need to implement the Index
trait for my class, but I'm not sure how to get the result I want. Maybe by nesting the impl
s? I really no idea.
Here is my code with a terrible attempt at implementing Index
for my structure, which obviously won't work for my purposes because it's one dimensional:
ANSWER
Answered 2017-Oct-03 at 14:20Make your struct indexible over objects of type (i32, i32)
.
QUESTION
I am making a roguelike based on Trystan's Tutorial and running into issues with implementing a class system. I'm pretty sure the solution is simple, but bear with me.
...ANSWER
Answered 2017-Oct-25 at 07:02you should make hitDie private, and make it accessible with getter and setter to enable the polimorphism (and so the getHitDie() invoked will be the one of the class Wizard instead of the one of the class CharacterClass)
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install roguelike-tutorial
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page