Nov-23-2019, 07:43 PM
Hello everyone,
Over the past week I have been making a game in Python using the graphical library Pyxel (https://github.com/kitao/pyxel) and made a little game that started out as a single python file and then grew into several different files as I implemented more features with each new day. This is the first version I released:
CG-20191118.py
Over the past week I have been making a game in Python using the graphical library Pyxel (https://github.com/kitao/pyxel) and made a little game that started out as a single python file and then grew into several different files as I implemented more features with each new day. This is the first version I released:
CG-20191118.py
import pyxel import random pyxel.init(255,160,caption="Circle Game 20191118") x = random.randrange(10,244) y = random.randrange(10,149) col = 7 debug = False def update(): global runtime,frame global x,y,col,debug if pyxel.btn(pyxel.KEY_LEFT) or pyxel.btn(pyxel.KEY_A): x-=1 if pyxel.btn(pyxel.KEY_RIGHT) or pyxel.btn(pyxel.KEY_D): x+=1 if pyxel.btn(pyxel.KEY_UP) or pyxel.btn(pyxel.KEY_W): y-=1 if pyxel.btn(pyxel.KEY_DOWN) or pyxel.btn(pyxel.KEY_S): y+=1 if pyxel.btn(pyxel.KEY_Q): col = col - 1 if col < 1: col = 15 if pyxel.btn(pyxel.KEY_E): col = col + 1 if col > 15: col = 1 if pyxel.btn(pyxel.KEY_R): x = random.randrange(0,244) y = random.randrange(0,149) if pyxel.btnp(pyxel.KEY_F): if debug == True: debug = False elif debug == False: debug = True def draw(): global runtime,frame global x,y,col,debug pyxel.cls(0) pyxel.circ(x,y,10,col) pyxel.text(0,0,"CG-20191118", 7) if debug == True: pyxel.text(0,6,"X: " + str(x),7) pyxel.text(0,12,"Y: " + str(y),7) pyxel.text(0,18,"COL: " + str(col),7) pyxel.run(update,draw)And then over the course of 4 days, I turned it into a functioning game with walls, a proper respawning system, and hazardous objects which will kill you when you touch them. I think it is pretty good considering that it was 4 days of development, I am 15 and have only a decent amount of experience with Python (I'm not very good with classes), plus most of that time was spent doing theatre stuff. If you want to look at the source code and maybe even propose changes to it, or if you want to try the game yourself, go to https://github.com/Flux3on/circle-game. Thank you to everyone who reads this post.