半成品,目前速度不能修改,另外某些状况下路径会比较奇怪,因为没有速度计算,包含了重力矢量,可以修改重力方向
import pygame as pg
import math
import time
import random
import math
class Particle(): #Tile is for generating maze
def __init__(self,x,y):
self.x,self.y = x,y
def draw(self,color = (100,100,100)): #x,y represents the tile coordinates
pg.draw.rect(screen,color,(self.x,self.y,2,2))
def rotation_matrix(angle,vector):
x,y = vector
angle = angle/180*math.pi
x_ = math.cos(angle)*x - math.sin(angle)*y
y_ = math.sin(angle)*x + math.cos(angle)*y
return x_,y_
def get_clicked():
x,y = pg.mouse.get_pos() #pixel coordinat