roguelike | A basic roguelike written in c | Game Engine library
kandi X-RAY | roguelike Summary
kandi X-RAY | roguelike Summary
A basic roguelike written in c++.
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
roguelike Key Features
roguelike Examples and Code Snippets
Community Discussions
Trending Discussions on roguelike
QUESTION
I'm doing some troubleshooting on a Lua function I wrote yesterday as part of a game development effort using the Love2D API. The function is designed to handle mob entities stepping around an obstruction in a tile-based roguelike type system with PG terrain. Code is below, though I'm not primarily looking for syntax help here, it's just for context. The troubleshooting raised an interesting question in my mind that I couldn't find the answer to in Lua's documentation.
For the curious, this particular function checks "left" and "right" of an obstruction for any given direction in a set of 8 directions, sees whether the square in that direction contains walkable terrain, and then walks onto it if so. If both directions are clear, it flips a coin. If both are blocked, it gives up (for now, for testing purposes).
I'm defining this inside of a (confirmed working) Entity class, hence all the "self" sugar. Move, canMove, and Wander are all also confirmed working methods of Entity.
...ANSWER
Answered 2022-Feb-10 at 21:38move
is not a valid Lua statement. You cannot just write an identifier on its own. You need to combine it with other things.
Adding self:
doesn't change that. It merely replaces the local move1
by a table element. Still this is an invalid expression.
The only thing that changes is that Lua now expects arguments as the colon syntax is only used in combination with functions.
If move1
is a function value you can call
QUESTION
I've been trying to create a roguelike from scratch, and it was going well until I got to character movement. I know how to find the location of the @(player), but I don't know how to replace individual characters of the string. I have been searching for around 30 minutes now, and I still can't find anything that works. Help would be greatly appreciated.
...ANSWER
Answered 2022-Jan-25 at 03:41Tell me if I missunderstood the question, but you can use splice function, something like this:
QUESTION
I am doing a roguelike game with turn based system in unity, the movement is more like chess, that you move from one place in the grid to another. Is more like moving between vectors then the grid itself.
I did the player's movement and enemy's movement and they are working just fine if i separatedly click the w, a, s, d keys. But when I try to hold it, the player still moves fine, but the enemy move more spaces then the player and it also dont move from grid to grid, but also stays most of the times between grids, more like if you are playing chess and you put the queen half of it in one space and half of it in another.
I know the problem is that it has something to do with the Update()
function, that happens only if i hold one of the movement keys, the PlayerScript and EnemyScript codes are all correct.
The 3 following codes are from the GameManager, PlayerScript and EnemyScript, the first take care of the turns, the second takes care of the player movement and the third the enemy movement.
Thanks in advance for the help :)
`
...ANSWER
Answered 2021-Dec-22 at 02:14But when I try to hold it, the player still moves fine, but the enemy move more spaces then the player
I suspect this is because your let the enemies move as soon as the player begins moving, even if the player hasn't reached his target position yet. And because you aren't using isMoving
to prevent your enemies from have multiple coroutines running at once (like you are with your player) then when you hold a key down, your player starts moving but your enemy gets several moves all at once while your player's coroutine is still running.
but also stays most of the times between grids, more like if you are playing chess and you put the queen half of it in one space and half of it in another.
Again, I suspect this is because you have multiple moveEnemy
coroutines running at once. So when the second instance of the coroutine starts, the enemy is a little bit between grid spaces because the first instance of the coroutine hasn't finished yet. So even though the second instance of the coroutine is only moving him 1 space, he starts out between spaces so he'll end up between spaces. And then that problem compounds depending on how many instances of the coroutine run.
There are a bunch of ways to fix it, but the way that I'd recommend is to change the value of game_state
to ENEMY_TURN
only once your player has finished moving and set it to PLAYER_TURN
only once all your enemies have finished moving. Then add a third state called BETWEEN_TURNS
or something like, and set game_state
to BETWEEN_TURNS
immediately after the player or enemy begins moving. Then do not accept any input during BETWEEN_TURNS
. That way you can make sure a complete turn has finished before you start the next turn and you don't have things moving simultaneously (unless that's what you want, in which case you'd need a different solution).
QUESTION
I've been learning Python by doing random projects here and there. My newest project is a simple text roguelike RPG. The player starts with base stats and just has to survive
Players can attack, heal or run. Which for the most part does work, however, I'm trying to display a kill count beside the player name and visible stats(exp and HP). I'm pretty sure my count variable is just misplaced as it resets to 0 after every enemy death. I want this because it SHOULD mimic b_count for boss appearance. My code is as follows:
...ANSWER
Answered 2021-Sep-26 at 15:21Inside the battle
function, you're setting the count
variable at the beginning of the function, but also resetting it in a loop before it gets displayed.
QUESTION
I'm working on a roguelike visibility function. I want to pass in a predicate to determine if the tile is blocking vision or not. The following code works as expected:
...ANSWER
Answered 2021-Sep-25 at 18:46This is due to lifetime elision. The default lifetime in the function case (a unique lifetime per parameter) is different than the default lifetime in the type
case ('static
). You need to be explicit that the lifetime is not static:
QUESTION
I am coding a roguelike, and am drawing each individual frame if the "coordinates" of the map are a certain number. Note: the indentation is correct in my project, it's just that stackoverflow is confusing. I made this code:
...ANSWER
Answered 2021-May-23 at 04:23It's not a glitch -- the code is doing exactly what you told it to do.
x and y both start at 0. If the user enters "s", y is increased to 1.
Your if/else block does not have any case that matches x == 0 and y == 1, so the print('\n\n\n\n\n\n\n...')
line runs forever.
Yes, I know the code has these lines:
QUESTION
I'm working on a roguelike game, and I tried printing the frames:
...ANSWER
Answered 2021-May-22 at 09:20i = 0
def lv1():
## check here , wrong indentation
while i == 0:
x = 0
y = 0
print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
if x == 0:
if y == 0:
print("@ - - - - - - - - - -")
print("- - - - - - - - - - -")
print("- - - - - - - - - - -")
print("- - - - - - - - - - []")
print("- - - - - - - - - - -")
print("- - - - - - - - - - -")
print("- - - - - - - - - - -")
print("- - - - - - - - - - -")
move = input("")
if move == "d":
x = 1
elif x == 1:
if y == 0:
print("- @ - - - - - - - - -")
print("- - - - - - - - - - -")
print("- - - - - - - - - - -")
print("- - - - - - - - - - []")
print("- - - - - - - - - - -")
print("- - - - - - - - - - -")
print("- - - - - - - - - - -")
print("- - - - - - - - - - -")
lv1() #invoke the function
QUESTION
New to Unity C# coding. I'm writing a script to achieve procedural generation in a 2D roguelike game. My idea is to use enum to represent 4 directions (up, down, left, right), then pick a random direction to produce a room from Prefab. Then next room will be generated by the same method. Here are my codes:
...ANSWER
Answered 2021-Jan-05 at 10:57You are missing variable name in your for-loop:
QUESTION
I've only started playing with xamarin recently but I'm making a roguelike using xamarin and I had the idea of using a grid for the player map (each X Y position in the grid would be representing the randomly generated map) I've hit a snag though in that putting things any thing over the 55th column seems to push them off the screen (See image below)
Here's my code so far:
...ANSWER
Answered 2020-Oct-08 at 06:02You should warp the content into a ScrollView and set Content = scrollView
, then you can scroll to see all the elements:
QUESTION
I'm trying to follow a Lua roguelike course to learn the language and by line 17 when I had attempted to run the program to see the title it came up with the error
...ANSWER
Answered 2020-Aug-27 at 14:18So I tried gideros and it worked properly, while it depends on lua it has it's own commands native to it's IDE framework.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install roguelike
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