Week 12: November 14th to 16th - ngetachew/Portfolio GitHub Wiki
On Wednesday, I spent the first half of the work period helping one of my partners create the UI for the game. The file that's used is main.py
. Rather than using a separate .kv file, it instantiates its kivy objects in the code. I learned that windows are comprised of Layouts, which are just "Widgets", things like buttons and labels, arranged in a certain order. The code in the screenshot uses a FloatLayout, which essentially just stacks the widgets on top of each other based on the order they're created in. With this layout, the popup should have a an image indicating the player has lost, with two buttons below it.
I spent Thursday and Friday acquainting myself with how display.py
creates the grid and all of the elements on the grid. The screenshot below shows how the grid is created as a Layout with specific dimensions that were decided on after me and my partners experimented with different values. The following for loop fills the grid with kivy objects that display transparent images, indicating that it is empty.
This next screenshot made me realize that the way each grid location is accessed is by its id which is "actor" plus its grid number(between 1 and 91). The way the move()
function works is by swapping ids and pictures.
With this information, I began working on the algorithm for the bear that hunts the player. The plan is to have the bear simply move as close as it can to the player in the beginning, and intercept the player in their path at the end.