Untitled
unknown
plain_text
a year ago
946 B
11
Indexable
import random
import tkinter as tk
import tkinter.ttk as ttk
import time
import datetime
from os import system, name
import customtkinter
# setup
app = customtkinter.CTk()
app.geometry('800x600')
app.title("Epic platformer")
ground = 600
xpos = 100
ypos = ground - 200
yvel = 0
xvel = 0
customtkinter.set_appearance_mode("dark")
floor = customtkinter.CTkButton(app, width=3000, height=200, text='', state='DISABLED', fg_color='gray', bg_color='gray')
floor.place(relx=0.5, y=ground, anchor='center')
player = customtkinter.CTkButton(app, width=30, height=30, text='', state='DISABLED', fg_color='white', bg_color='white')
player.place(x=xpos, y=ypos, anchor='center')
def update_game():
global ypos, yvel
if ypos < ground - 20:
yvel += 0.1
ypos += yvel
player.place(x=xpos, y=ypos, anchor='center')
app.after(10, update_game)
# start the game loop
update_game()
app.mainloop()
Editor is loading...
Leave a Comment