Quote:
Originally Posted by clowntable
Just read through the documentation for sqlalchemy and build a helper python file that creates an sqlite database of the items for my game
I used to read them from a .txt file with a selfinvented storing convention...time to test how good my OOP-abstraction was and hopefully just swap out the "loadItems" logic in the Scene class and replace it with sqlalchemy stuff for reading from the database
Works...I can now do the following:
1) Create a Scene object and draw it (i.e. blit a background image), Create a Player and Inventory object and load their look (i.e. blit an image representing them onto the scene)
2) Load all Items for the scene from an SQLite database and blit them onto the scene at the locations specified in the DB
3) Change the mouse logic by cycling through actions on rightclick (walk, take, look etc), no change of mousecursor yet though
4) Walk the player around by teleporting him to the loation of the mouseclick if the mouseaction is set to walk (i.e. no animation in place yet) and some basic collision detection
5) Show the name of the items if the mouse hovers over them (currently using the system font, will eventually be a custom one but still looks nice)
6) Output of current action and what is clicked on i.e. a rudimentary acrtion handler
7) If an item is takeable, if action is set to take and the item is leftclicked, put it into the inventory (inventory has slots, it'll be put in the first available one) and remove it from the scene
8) Quit the game
Also have a helper file that builds the item DB from a python script (easier to make changes that way imo)
Next on the TODO list:
- Change cursor to corresponding action (I'll make the cursor invisible and replace it with a graphic)
- Create some icon graphics for items for the inventory
- Change the inventory to basically be a black bar at the bottom that only shows up if the mouse is hovered over it and also implement a next page button if it's full
That's all fairly small stuff (I hope) and will conclude the first prototype after which I'll refactor/redesign some stuff; clean up the code, write better comments/docstrings and write tests. I'll probably make a design thread for this.