tkhirianov / foxford_2018 Goto Github PK
View Code? Open in Web Editor NEWФоксфорд - Информатика, 2018-2019 год.
License: GNU General Public License v3.0
Фоксфорд - Информатика, 2018-2019 год.
License: GNU General Public License v3.0
Изменить ball.step так, чтобы моделировалась физика Ньютона (классика).
Сейчас в программе один single_ball.
Нужно хранить не один шарик, а список шариков.
Ну, тут писать-то нечего...
Возможно, придётся использовать переменные Tkinter.
Игра должна заканчиваться, когда шариков не становится.
Хочется добавлять шарики прямо во время игры, и сложность игры в связи с этим со временем усложнялась.
Варианты реализации:
Т.е. по клику на холст обнаруживать нужный шарик и удалять его, запуская для него ball_delete(ball).
Старый код функции-прототипа обработки клика:
# FIXME: исправить отработку клика
"""
def click_handler(event):
global x, y, r, scores_text, scores
print(event.x, event.y)
if oval_id is not None:
if ((event.x - x)**2 + (event.y - y)**2) <= r**2:
print("Попал!")
scores += 100
scores_text["text"] = "Ваши очки: " + str(scores)
r = randint(10, 30)
x = randint(0+r, 639-r)
y = randint(0+r, 479-r)
canvas.coords(oval_id, (x-r, y-r, x+r, y+r))
"""
Привязка события в программе-прототипе:
# FIXME: вернуть кликабельность шариков
# canvas.bind("<Button>", click_handler)
Создать класс Ball, куда вынести все вещи, связанные с мячиком и их физикой.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.