Obstacle4_image = ("obstacles/obstacle4.png") Obstacle3_image = ("obstacles/obstacle3.png") Obstacle2_image = ("obstacles/obstacle2.png") Obstacle1_image = ("obstacles/obstacle1.png") I also made a video so you can get a better understanding of what the problem is. Thread(target=lambda: timer(my_sprite.score)).start() WINDOW.blit(chosen_obstacle, (imgX, 323)) Obstacles_tuple = (obstacle1, obstacle2, obstacle3, obstacle4, obstacle5)Ĭhosen_obstacle = random.choice(obstacles_tuple) How can I render the obstacles more smoothly? The relevant parts of the code: import pygame The problem is that when the score surpasses 35, obstacles appear on top of each other, some appear and disappear constantly and it just looks bad and very laggy. So what I want to do is when the user's score surpasses 35, obstacles will start being randomly generated. I managed to create all of the dinosaur sprite animations (walking, jumping and bending) and now I'm trying to add the obstacles. I don't have much experience with pygame. We were also hoping to add some gravity features where obstacles can jump with realistic believability.I'm trying to make a clone of google chrome dinosaur game in Python pygame. We were hoping to cover while-loops and other Python elements that we thought were crucial building blocks for anyone working with code. The next steps for Code Runner would be adding more concepts covered through the game functionality. We also learned a lot about education, through both introspection into ourselves as well as some research articles we found about how best to teach concepts and drill practice. We learned so much about game design and the implementation of computer science skills we learned in the classroom. We are proud of the cleanliness and truthfulness this hold with our mission statement-giving the user the most hand-ons and accurate coding experience. The idea we settled upon, the most graceful, was a method through which the user input is directly input into the character behavior instantiation, meaning that the user code is directly what is running the character-no proxies or comparison strings. We considered making pre-written code snippets that the game would compare to the user input or creating a pseudocode system that could interpret the user's intentions. We had many different approaches for incorporating the user input into the game, that finding one that worked proved to be very difficult. We were most proud of the code incorporation feature. We also had difficulty with the graphics side of the project as that is something that we do not actively focus on learning through standard CS courses in school. The idea we settled on still challenged us, but was something we thought was accomplishable. While there were some ideas that had heavily utilizing AI and VR, we knew that we could not code that up in 36 hours. Finding that halfway point pushed both our creativity and technical abilities. We had most trouble with troubleshooting an idea that is both educational and fun. Furthermore, we implemented a file structure for all educators to customize their own programming lessons and custom functions to target specific concepts, such as for loops and while loops. We then integrated a text editor that allows quick and dirty compilation of Python code into the visually appealing format of the game. We began with a Pygame template and created a game akin to the "Dinosaur game" of Google Chrome. The game covers the basic concepts behind integers, loops, and boolean statements. Players can code the behavior for the given level, telling the player to "jump when the obstacles is 10 pixels away" with workable Python script. However, as the player experiences more and more difficult obstacles through the level progression, they are encouraged to automate the character behavior with the use of Python commands. ![]() ![]() This code models a "dinosaur game" structure where players have to jump over obstacles. The code the students learn is actual Python script, but it guided with the help of an interactive tutorial. We thought the ideal learning environment would be an interactive experience where players have to learn to code, not for a grade or score, but to progress an already interactive game. We found that even there are so many resources to learn to code, but all of them fall into one of two categories: they are either in a generic course and grade structure, or are oversimplified to fit a high-level mould.
0 Comments
Leave a Reply. |