Linux Game Jam 2023 mini-contribution

This commit is contained in:
John McCardle 2023-07-08 19:42:47 -04:00
parent 97793fb26b
commit 76ac236be3
7 changed files with 156 additions and 26 deletions

BIN
assets/Sprite-0001.ase Normal file

Binary file not shown.

BIN
assets/Sprite-0001.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -1,3 +1,4 @@
#!/bin/bash #!/bin/bash
cp src/scripts/*.py bin/linux/scripts/
cd bin/linux cd bin/linux
./mcrogueface ./mcrogueface

View File

@ -8,7 +8,7 @@
GameEngine::GameEngine() GameEngine::GameEngine()
{ {
font.loadFromFile("./assets/JetbrainsMono.ttf"); font.loadFromFile("./assets/JetbrainsMono.ttf");
window.create(sf::VideoMode(1024, 768), "McRogueFace - 7DRL Submission by John McCardle"); window.create(sf::VideoMode(1024, 768), "McRogueFace - LGJ Submission by John McCardle");
visible = window.getDefaultView(); visible = window.getDefaultView();
window.setFramerateLimit(30); window.setFramerateLimit(30);
scene = "menu"; scene = "menu";

View File

@ -4,7 +4,7 @@
MenuScene::MenuScene(GameEngine* g) : Scene(g) MenuScene::MenuScene(GameEngine* g) : Scene(g)
{ {
text.setFont(game->getFont()); text.setFont(game->getFont());
text.setString("McRogueFace Engine - 7DRL 2023 Submission (Incomplete)"); text.setString("McRogueFace Engine - LGJ 2023 (Incomplete)");
text.setCharacterSize(24); text.setCharacterSize(24);
//std::cout << "MenuScene Initialized. " << game << std::endl; //std::cout << "MenuScene Initialized. " << game << std::endl;
//std::cout << "Font: " << game->getFont().getInfo().family << std::endl; //std::cout << "Font: " << game->getFont().getInfo().family << std::endl;
@ -13,6 +13,11 @@ MenuScene::MenuScene(GameEngine* g) : Scene(g)
text2.setString("Press 'Spacebar' to run demo"); text2.setString("Press 'Spacebar' to run demo");
text2.setCharacterSize(16); text2.setCharacterSize(16);
text2.setPosition(0.0f, 50.0f); text2.setPosition(0.0f, 50.0f);
text3.setFont(game->getFont());
text3.setString("use 'W' 'A' 'S' 'D' to move (even when blank; it's a bug)");
text3.setCharacterSize(16);
text3.setPosition(0.0f, 80.0f);
registerAction(ActionCode::KEY + sf::Keyboard::Space, "start_game"); registerAction(ActionCode::KEY + sf::Keyboard::Space, "start_game");
registerAction(ActionCode::KEY + sf::Keyboard::Up, "up"); registerAction(ActionCode::KEY + sf::Keyboard::Up, "up");
@ -43,5 +48,6 @@ void MenuScene::sRender()
game->getWindow().clear(); game->getWindow().clear();
game->getWindow().draw(text); game->getWindow().draw(text);
game->getWindow().draw(text2); game->getWindow().draw(text2);
game->getWindow().draw(text3);
game->getWindow().display(); game->getWindow().display();
} }

View File

@ -8,6 +8,7 @@ class MenuScene: public Scene
{ {
sf::Text text; sf::Text text;
sf::Text text2; sf::Text text2;
sf::Text text3;
public: public:
MenuScene(GameEngine*); MenuScene(GameEngine*);

View File

@ -26,6 +26,7 @@ class TestEntity:
self.facing_direction = 0 self.facing_direction = 0
self.do_fov = do_fov self.do_fov = do_fov
self.label = label self.label = label
self.inventory = []
#print(f"Calling C++ with: {repr((self.grid, label, tex_index, self.basesprite, x, y, self))}") #print(f"Calling C++ with: {repr((self.grid, label, tex_index, self.basesprite, x, y, self))}")
grids = mcrfpy.listGrids() grids = mcrfpy.listGrids()
for g in grids: for g in grids:
@ -34,7 +35,8 @@ class TestEntity:
mcrfpy.createEntity(self.grid, label, tex_index, self.basesprite, x, y, self) mcrfpy.createEntity(self.grid, label, tex_index, self.basesprite, x, y, self)
def ai_act(self): def ai_act(self):
if self.label == "player": return return # no AI motion
#if self.label == "player": return
self.move(randint(-1, 1), randint(-1, 1)) self.move(randint(-1, 1), randint(-1, 1))
scene.actors += 1 scene.actors += 1
@ -43,15 +45,38 @@ class TestEntity:
mcrfpy.unlockPlayerInput() mcrfpy.unlockPlayerInput()
scene.updatehints() scene.updatehints()
def move(self, dx, dy): def die(self):
#self.x = -2
#self.y = -2
self.move(-1000,-1000)
self.animate(0,animove=(-1000,-1000))
self.x = -1000
self.y = -1000
self.label = "dead"
def interact(self, initiator, callback):
print(f"Interacted with {self.label}. ", end='')
if self.label == 'item':
print("'taking' item.")
callback()
self.die()
else:
print("blocking movement.")
def move(self, dx, dy, force=False):
# select animation direction # select animation direction
# prefer left or right for diagonals. # prefer left or right for diagonals.
#grids = mcrfpy.listGrids() #grids = mcrfpy.listGrids()
for g in scene.grids: for g in scene.grids:
if g.title == self.grid: if g.title == self.grid:
if g.at(self.x + dx, self.y + dy) is None or not g.at(self.x + dx, self.y + dy).walkable: if not force and g.at(self.x + dx, self.y + dy) is None or not g.at(self.x + dx, self.y + dy).walkable:
#print("Blocked at target location.") #print("Blocked at target location.")
return return
if not force: # entities can be stepped on when force=True (like collecting items!)
for entity in scene.tes:
if (entity.x, entity.y) == (self.x + dx, self.y + dy):
print(f"Blocked by entity {entity.label} at ({entity.x}, {entity.y})")
return entity.interact(self, lambda: self.move(dx, dy, force=True))
if self.label == "player": if self.label == "player":
mcrfpy.lockPlayerInput() mcrfpy.lockPlayerInput()
scene.updatehints() scene.updatehints()
@ -70,7 +95,7 @@ class TestEntity:
start_sprite = self.basesprite + (self.texture_width * (direction + (4 if attacking else 0))) start_sprite = self.basesprite + (self.texture_width * (direction + (4 if attacking else 0)))
animation_frames = [start_sprite + i for i in range((self.attack_frames if attacking else self.walk_frames))] animation_frames = [start_sprite + i for i in range((self.attack_frames if attacking else self.walk_frames))]
mcrfpy.createAnimation( mcrfpy.createAnimation(
0.25, # duration, seconds 0.15, # duration, seconds
self.grid, # parent: a UIMenu or Grid key self.grid, # parent: a UIMenu or Grid key
"entity", # target type: 'menu', 'grid', 'caption', 'button', 'sprite', or 'entity' "entity", # target type: 'menu', 'grid', 'caption', 'button', 'sprite', or 'entity'
self.entity_index, # target id: integer index for menu or grid objs; None for grid/menu self.entity_index, # target id: integer index for menu or grid objs; None for grid/menu
@ -119,10 +144,41 @@ class TestEntity:
#animations_in_progress -= 1 #animations_in_progress -= 1
scene.actors -= 1 scene.actors -= 1
#print(f"{self} done animating - {scene.actors} remaining") #print(f"{self} done animating - {scene.actors} remaining")
if scene.actors == 0: if scene.actors <= 0:
scene.actors = 0
mcrfpy.unlockPlayerInput() mcrfpy.unlockPlayerInput()
scene.updatehints() scene.updatehints()
class TestItemEntity(TestEntity):
def __init__(self, grid, label, tex_index, basesprite, x, y, texture_width=64, walk_frames=5, attack_frames=6, do_fov=False, item="Nothing"):
super().__init__(grid, label, tex_index, basesprite, x, y, texture_width, walk_frames, attack_frames, do_fov)
self.item = item
def interact(self, initiator, callback):
if self.label == 'dead': return super().interact(initiator, callback)
print(f"Interacted with {self.label}, an item. Adding {self.item} to {initiator.label}'s inventory")
initiator.inventory.append(self.item)
callback()
scene.itemguis()
self.die()
class TestDoorEntity(TestEntity):
def __init__(self, grid, label, tex_index, basesprite, x, y, texture_width=64, walk_frames=5, attack_frames=6, do_fov=False, key="Nothing"):
super().__init__(grid, label, tex_index, basesprite, x, y, texture_width, walk_frames, attack_frames, do_fov)
self.key = key
def interact(self, initiator, callback):
if self.label == 'dead': return super().interact(initiator, callback)
print(f"Interacted with {self.label}, a Door. ", end='')
if self.key in initiator.inventory:
initiator.inventory.remove(self.key)
print("Taking key & passing.")
callback()
scene.itemguis()
self.die()
else:
print("The door is locked.")
class TestScene: class TestScene:
def __init__(self, ui_name = "demobox1", grid_name = "demogrid"): def __init__(self, ui_name = "demobox1", grid_name = "demogrid"):
# Texture & Sound Loading # Texture & Sound Loading
@ -132,9 +188,12 @@ class TestScene:
mcrfpy.createTexture("./assets/alives_other.png", 16, 64, 64) #1 - TinyWorld NPCs mcrfpy.createTexture("./assets/alives_other.png", 16, 64, 64) #1 - TinyWorld NPCs
mcrfpy.createTexture("./assets/alives_other.png", 32, 32, 32) #2 - TinyWorld NPCs - 2x2 sprite mcrfpy.createTexture("./assets/alives_other.png", 32, 32, 32) #2 - TinyWorld NPCs - 2x2 sprite
mcrfpy.createTexture("./assets/custom_player.png", 16, 5, 13) #3 - player mcrfpy.createTexture("./assets/custom_player.png", 16, 5, 13) #3 - player
mcrfpy.createTexture("./assets/Sprite-0001.png", 80, 10, 10) #4 - LGJ2023 keycard + other icons
mcrfpy.createTexture("./assets/tiny_keycards.png", 16, 8, 8) #5 - tiny keycards (ground items)
self.ui_name = ui_name self.ui_name = ui_name
self.grid_name = grid_name self.grid_name = grid_name
# Menu index = 0
#print("Create UI") #print("Create UI")
# Create dialog UI # Create dialog UI
mcrfpy.createMenu(ui_name, 20, 540, 500, 200) mcrfpy.createMenu(ui_name, 20, 540, 500, 200)
@ -142,18 +201,20 @@ class TestScene:
mcrfpy.createCaption(ui_name, "", 24, RED) mcrfpy.createCaption(ui_name, "", 24, RED)
#mcrfpy.createButton(ui_name, 250, 20, 100, 50, DARKBLUE, (0, 0, 0), "clicky", "testaction") #mcrfpy.createButton(ui_name, 250, 20, 100, 50, DARKBLUE, (0, 0, 0), "clicky", "testaction")
mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKRED, (0, 0, 0), "REPL", "startrepl") mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKRED, (0, 0, 0), "REPL", "startrepl")
mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKGREEN, (0, 0, 0), "map gen", "gridgen") ##mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKGREEN, (0, 0, 0), "map gen", "gridgen")
#mcrfpy.createButton(ui_name, 250, 20, 100, 50, DARKGREEN, (0, 0, 0), "mapL", "gridgen2") #mcrfpy.createButton(ui_name, 250, 20, 100, 50, DARKGREEN, (0, 0, 0), "mapL", "gridgen2")
#mcrfpy.createButton(ui_name, 250, 20, 100, 50, DARKBLUE, (192, 0, 0), "a_menu", "animtest") #mcrfpy.createButton(ui_name, 250, 20, 100, 50, DARKBLUE, (192, 0, 0), "a_menu", "animtest")
#mcrfpy.createButton(ui_name, 250, 20, 100, 50, DARKRED, GREEN, "a_spr", "animtest2") #mcrfpy.createButton(ui_name, 250, 20, 100, 50, DARKRED, GREEN, "a_spr", "animtest2")
#mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKBLUE, GREEN, "Next sp", "nextsp") #mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKBLUE, GREEN, "Next sp", "nextsp")
#mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKBLUE, RED, "Prev sp", "prevsp") #mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKBLUE, RED, "Prev sp", "prevsp")
#mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKBLUE, DARKGREEN, "+16 sp", "skipsp") #mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKBLUE, DARKGREEN, "+16 sp", "skipsp")
mcrfpy.createSprite(ui_name, 0, 0, 20, 20, 5.0) mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKGREEN, (0, 0, 0), "Next", "nextsp")
mcrfpy.createButton(ui_name, 250, 0, 130, 40, DARKBLUE, (0, 0, 0), "Prev", "prevsp")
mcrfpy.createSprite(ui_name, 4, 1, 10, 10, 2.0)
# Menu index = 1
#print("Create UI 2") #print("Create UI 2")
entitymenu = "entitytestmenu" entitymenu = "entitytestmenu"
mcrfpy.createMenu(entitymenu, 840, 20, 20, 500) mcrfpy.createMenu(entitymenu, 840, 20, 20, 500)
mcrfpy.createButton(entitymenu, 0, 10, 150, 40, DARKBLUE, BLACK, "Up", "test_up") mcrfpy.createButton(entitymenu, 0, 10, 150, 40, DARKBLUE, BLACK, "Up", "test_up")
mcrfpy.createButton(entitymenu, 0, 60, 150, 40, DARKBLUE, BLACK, "Down", "test_down") mcrfpy.createButton(entitymenu, 0, 60, 150, 40, DARKBLUE, BLACK, "Down", "test_down")
@ -162,39 +223,69 @@ class TestScene:
mcrfpy.createButton(entitymenu, 0, 210, 150, 40, DARKBLUE, BLACK, "Attack", "test_attack") mcrfpy.createButton(entitymenu, 0, 210, 150, 40, DARKBLUE, BLACK, "Attack", "test_attack")
mcrfpy.createButton(entitymenu, 0, 210, 150, 40, DARKBLUE, RED, "TE", "testent") mcrfpy.createButton(entitymenu, 0, 210, 150, 40, DARKBLUE, RED, "TE", "testent")
# Menu index = 2
mcrfpy.createMenu( "gridtitlemenu", 0, -10, 0, 0) mcrfpy.createMenu( "gridtitlemenu", 0, -10, 0, 0)
mcrfpy.createCaption("gridtitlemenu", "<grid name>", 18, WHITE) mcrfpy.createCaption("gridtitlemenu", "<grid name>", 18, WHITE)
#mcrfpy.createCaption("gridtitlemenu", "<camstate>", 16, WHITE) #mcrfpy.createCaption("gridtitlemenu", "<camstate>", 16, WHITE)
# Menu index = 3
mcrfpy.createMenu( "hintsmenu", 0, 505, 0, 0) mcrfpy.createMenu( "hintsmenu", 0, 505, 0, 0)
mcrfpy.createCaption("hintsmenu", "<hintline>", 16, WHITE) mcrfpy.createCaption("hintsmenu", "<hintline>", 16, WHITE)
# Menu index = 4
# menu names must be created in alphabetical order (?!) - thanks, C++ hash map # menu names must be created in alphabetical order (?!) - thanks, C++ hash map
mcrfpy.createMenu( "i", 600, 20, 0, 0) mcrfpy.createMenu( "i", 600, 20, 0, 0)
#mcrfpy.createMenu( "camstatemenu", 600, 20, 0, 0) #mcrfpy.createMenu( "camstatemenu", 600, 20, 0, 0)
mcrfpy.createCaption("i", "<camstate>", 16, WHITE) mcrfpy.createCaption("i", "<camstate>", 16, WHITE)
# Menu index = 5
mcrfpy.createMenu( "j", 600, 500, 0, 0) mcrfpy.createMenu( "j", 600, 500, 0, 0)
mcrfpy.createButton( "j", 0, 0, 80, 40, DARKBLUE, WHITE, "Recenter", "activatecamfollow") mcrfpy.createButton( "j", 0, 0, 80, 40, DARKBLUE, WHITE, "Recenter", "activatecamfollow")
# Menu index = 6, 7, 8, 9, 10: keycard sprites
mcrfpy.createMenu("k", 540, 540, 80, 80) #6
mcrfpy.createSprite("k", 4, 0, 10, 10, 1.0)
mcrfpy.createMenu("l", 540 + (80 * 1), 540, 80, 80) #7
mcrfpy.createSprite("l", 4, 1, 10, 10, 1.0)
mcrfpy.createMenu("m", 540 + (80 * 2), 540, 80, 80) #8
mcrfpy.createSprite("m", 4, 2, 10, 10, 1.0)
mcrfpy.createMenu("n", 540 + (80 * 3), 540, 80, 80) #9
mcrfpy.createSprite("n", 4, 3, 10, 10, 1.0)
mcrfpy.createMenu("o", 540 + (80 * 4), 540, 80, 80) #10
mcrfpy.createSprite("o", 4, 4, 10, 10, 1.0)
#print("Make UIs visible") #print("Make UIs visible")
self.menus = mcrfpy.listMenus() self.menus = mcrfpy.listMenus()
self.menus[0].visible = True self.menus[0].visible = True
self.menus[1].w = 170 self.menus[1].w = 170
self.menus[1].visible = True self.menus[1].visible = True
#self.menus[2].visible = True #self.menus[2].visible = True
self.menus[2].bgcolor = BLACK
self.menus[3].visible = True for mn in range(2, 6):
self.menus[3].bgcolor = BLACK self.menus[mn].bgcolor = BLACK
self.menus[4].visible = True self.menus[mn].visible = True
self.menus[4].bgcolor = BLACK mcrfpy.modMenu(self.menus[mn])
self.menus[5].visible = True
mcrfpy.modMenu(self.menus[0]) for mn in range(6, 11):
mcrfpy.modMenu(self.menus[1]) self.menus[mn].bgcolor = BLACK
mcrfpy.modMenu(self.menus[2]) self.menus[mn].visible = False
mcrfpy.modMenu(self.menus[3]) mcrfpy.modMenu(self.menus[mn])
mcrfpy.modMenu(self.menus[4])
mcrfpy.modMenu(self.menus[5]) #self.menus[2].bgcolor = BLACK
#self.menus[3].visible = True
#self.menus[3].bgcolor = BLACK
#self.menus[4].visible = True
#self.menus[4].bgcolor = BLACK
#self.menus[5].visible = True
#mcrfpy.modMenu(self.menus[0])
#mcrfpy.modMenu(self.menus[1])
#mcrfpy.modMenu(self.menus[2])
#mcrfpy.modMenu(self.menus[3])
#mcrfpy.modMenu(self.menus[4])
#mcrfpy.modMenu(self.menus[5])
#pprint(mcrfpy.listMenus()) #pprint(mcrfpy.listMenus())
#print(f"UI 1 gave back this sprite: {self.menus[0].sprites}") #print(f"UI 1 gave back this sprite: {self.menus[0].sprites}")
@ -209,19 +300,42 @@ class TestScene:
#mcrfpy.createEntity("demogrid", "tinyenemy", 1, 1538, 3, 6, lambda: None) #mcrfpy.createEntity("demogrid", "tinyenemy", 1, 1538, 3, 6, lambda: None)
#print("Create fancy entity") #print("Create fancy entity")
self.player = TestEntity("demogrid", "player", 3, 20, 17, 3, 5, walk_frames=4, attack_frames=5, do_fov=True)
self.tes = [ self.tes = [
TestEntity("demogrid", "classtest", 1, 1538, 5, 7, 64, walk_frames=5, attack_frames=6), TestEntity("demogrid", "classtest", 1, 1538, 5, 7, 64, walk_frames=5, attack_frames=6),
TestEntity("demogrid", "classtest", 1, 1545, 7, 9, 64, walk_frames=5, attack_frames=6), TestEntity("demogrid", "classtest", 1, 1545, 7, 9, 64, walk_frames=5, attack_frames=6),
TestEntity("demogrid", "classtest", 1, 1552, 9, 11, 64, walk_frames=5, attack_frames=6), TestEntity("demogrid", "classtest", 1, 1552, 9, 11, 64, walk_frames=5, attack_frames=6),
TestEntity("demogrid", "classtest", 1, 1566, 11, 13, 64, walk_frames=4, attack_frames=6), TestEntity("demogrid", "classtest", 1, 1566, 11, 13, 64, walk_frames=4, attack_frames=6),
TestEntity("demogrid", "classtest", 1, 1573, 13, 15, 64, walk_frames=4, attack_frames=6), #TestEntity("demogrid", "item", 1, 1573, 13, 15, 64, walk_frames=4, attack_frames=6),
TestEntity("demogrid", "classtest", 1, 1583, 15, 17, 64, walk_frames=4, attack_frames=6), TestEntity("demogrid", "classtest", 1, 1583, 15, 17, 64, walk_frames=4, attack_frames=6),
TestEntity("demogrid", "classtest", 1, 130, 9, 7, 64, walk_frames=5, attack_frames=6), TestEntity("demogrid", "classtest", 1, 130, 9, 7, 64, walk_frames=5, attack_frames=6),
TestEntity("demogrid", "classtest", 1, 136, 11, 9, 64, walk_frames=5, attack_frames=6), TestEntity("demogrid", "classtest", 1, 136, 11, 9, 64, walk_frames=5, attack_frames=6),
TestEntity("demogrid", "classtest", 1, 143, 13, 11, 64, walk_frames=5, attack_frames=6), TestEntity("demogrid", "classtest", 1, 143, 13, 11, 64, walk_frames=5, attack_frames=6),
TestEntity("demogrid", "classtest", 1, 158, 15, 13, 64, walk_frames=5, attack_frames=6), TestEntity("demogrid", "classtest", 1, 158, 15, 13, 64, walk_frames=5, attack_frames=6),
TestEntity("demogrid", "classtest", 1, 165, 17, 15, 64, walk_frames=5, attack_frames=6), TestEntity("demogrid", "classtest", 1, 165, 17, 15, 64, walk_frames=5, attack_frames=6),
TestEntity("demogrid", "player", 3, 20, 17, 3, 5, walk_frames=4, attack_frames=5, do_fov=True) self.player,
TestItemEntity("demogrid", "GreenKeyCard", 5, 0, 19, 3, texture_width=64,
walk_frames=5, attack_frames=6, do_fov=False, item="Green Keycard"),
TestItemEntity("demogrid", "BlueKeyCard", 5, 1, 21, 3, texture_width=64,
walk_frames=5, attack_frames=6, do_fov=False, item="Blue Keycard"),
TestItemEntity("demogrid", "RedKeyCard", 5, 2, 23, 3, texture_width=64,
walk_frames=5, attack_frames=6, do_fov=False, item="Red Keycard"),
TestItemEntity("demogrid", "OrangeKeyCard", 5, 3, 25, 3, texture_width=64,
walk_frames=5, attack_frames=6, do_fov=False, item="Orange Keycard"),
TestItemEntity("demogrid", "DevilKeyCard", 5, 4, 27, 3, texture_width=64,
walk_frames=5, attack_frames=6, do_fov=False, item="Devil Keycard"),
TestDoorEntity("demogrid", "GreenKeyDoor", 5, 8, 19, 5, texture_width=64,
walk_frames=5, attack_frames=6, do_fov=False, key="Green Keycard"),
TestDoorEntity("demogrid", "BlueKeyDoor", 5, 9, 21, 5, texture_width=64,
walk_frames=5, attack_frames=6, do_fov=False, key="Blue Keycard"),
TestDoorEntity("demogrid", "RedKeyDoor", 5, 10, 23, 5, texture_width=64,
walk_frames=5, attack_frames=6, do_fov=False, key="Red Keycard"),
TestDoorEntity("demogrid", "OrangeKeyDoor", 5, 11, 25, 5, texture_width=64,
walk_frames=5, attack_frames=6, do_fov=False, key="Orange Keycard"),
TestDoorEntity("demogrid", "DevilKeyDoor", 5, 12, 27, 5, texture_width=64,
walk_frames=5, attack_frames=6, do_fov=False, key="Devil Keycard")
] ]
self.grids = mcrfpy.listGrids() self.grids = mcrfpy.listGrids()
@ -250,6 +364,13 @@ class TestScene:
self.gridgen() self.gridgen()
self.updatehints() self.updatehints()
mcrfpy.camFollow(True) mcrfpy.camFollow(True)
def itemguis(self):
print(self.player.inventory)
items = ["Green Keycard", "Blue Keycard", "Red Keycard", "Orange Keycard", "Devil Keycard"]
for mn in range(6, 11):
self.menus[mn].visible = items[mn-6] in self.player.inventory
mcrfpy.modMenu(self.menus[mn])
def animate_entity(self, direction, attacking=False): def animate_entity(self, direction, attacking=False):
if direction is None: if direction is None:
@ -332,7 +453,7 @@ class TestScene:
p.walkable = False p.walkable = False
p.transparent = False p.transparent = False
room_centers = [(randint(0, self.grids[0].grid_x-1), randint(0, self.grids[0].grid_y-1)) for i in range(20)] + [(17, 3)] room_centers = [(randint(0, self.grids[0].grid_x-1), randint(0, self.grids[0].grid_y-1)) for i in range(20)] + [(17, 3), (20,10) + (20,5)]
#room_centers.append((3, 5)) #room_centers.append((3, 5))
for r in room_centers: for r in room_centers:
# random hallway # random hallway
@ -420,4 +541,5 @@ def start():
global scene global scene
#print("TestScene.start called") #print("TestScene.start called")
scene = TestScene() scene = TestScene()
mcrfpy.refreshFov()
scene.updatehints()