By Sweta Kumari
By using the math module and pygame module from Python we will be designing this fun line tracker game.
this project Tracks the line on a blank black screen.
You just have to drag the line and leave the cursor of the mouse when you will get the desired length of your line.
This could also help full as a black board using python for writing something.
This project only used math module and pygame module from python
import pygame from pygame import Vector2 width = 1200 height = 700 con = 0
The above code is used to import both the module and make a good dark screen for you.
then we have these functions to operate on the all line that we are making on that particular blank screen.
class Line(): def __init__(self, start, end): self.start = start self.end = end def draw(self, screen): pygame.draw.line(screen, (255, 255, 255), self.start, self.end, 1) class Points(): def __init__(self, pos): self.pos = pos self.reached = False def reach(self): self.reached = True def isReached(self): return self.reached class Car(): def __init__(self, pos): self.pos = pos self.v = Vector2(0, 1) self.a = Vector2(0, 0) self.r = 10 self.maxspeed = 5 self.maxforce = .5
Submitted by Sweta Kumari (Sweta1904)
Download packets of source code on Coders Packet
Comments