Natalie's game app

by Natalie Le

09 Mar 2016

Milestones:

  • Screen background
  • import shark image
  • multiple sharks appears
  • multiple sharks move horizontally
    • at different locations
    • in different directions
    • sharks move to edge of screen then bounce back
  • if Tommy touches a shark, Tommy loses 1 life
  • if Tommy touches a treasure, count increase 1 point
  • After collecting all treasures, Tommy can go to Tina to be reunited Code:
  • functions are separated in different modules
  • codes are commented
  • uses custom class

There were so many problems that I encountered with this game app. The first obvious one is that the program is very slow to start up. I thought its because it’s waiting to draw the background then show it but I did set the speed to 0 so I have no idea why it’s like that. I spent quite a bit of time to figure out how to move the sharks to the edge and then bounce back and was able to make it work. However, that function seems to take over the program and I wasnt able to use onclick or onkey to navigate Tommy at all. So, bummer… Another thing that I couldnt figure out was when Tommy is stationery and a shark moves onto him, the distance command doesnt get executed. I tried putting it outside the onclick function and inside the shark’s move() function but it still doesnt work.

Another major problem I had was this error. For some reason I couldnt import Tommy or some other variables into some modules. I also couldnt import anything from the main module. I wonder if I’m doing anything wrong? Game

When I tried to use reset for example myscreen.reset() but even if I do setup() afterwards it still doesnt set things up right and just messes everything up. reset

I still have problem with global/local variables. I have no idea why this happened. reset

So because of all these problems, I have scaled down my milestones considerably. I think what I’m satisfied with this app is that I was able to use class to simplify and streamline a number of repetative things like writing messages, creating sharks etc.

Natalie is a first year MSPH student at the Gillings School of Public Health. Find Natalie Le on Twitter, Github, and on the web.