[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Game Development Tutorial – 11 – Line Drawing Program
by
Tags:
Comments
27 responses to “Game Development Tutorial – 11 – Line Drawing Program”
-
That's what she said…
man i wish i could subscribe twice…you're the best -
check this out
import random
import pygame
import sys
from pygame.locals import *pygame.init()
screen=pygame.display.set_mode ((1024, 576),0,32)
red = random.randint(0,255)
green = random.randint(0,255)
blue = random.randint(0,255)
colour=(red,blue,green)points=[]
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.type==MOUSEBUTTONDOWN:
points.append(event.pos)
if event.type==MOUSEBUTTONUP:
red = random.randint(0,255)
green = random.randint(0,255)
blue = random.randint(0,255)
colour=(red,blue,green)if len(points)>1:
pygame.draw.lines(screen, colour, False, points, 5)pygame.display.update()
-
If he writes something in caps and you don't from pygame.locals import *. Then it starts with pygame. e.g. pygame.MOUSEBUTTONDOWN or pygame.QUIT
-
you guys should try , True instead of false, I think it's faiirly cool.
-
ok i saw what happened when replaced true instead of false.but why?
-
I got the invalid syntax error with the 'points=[]' list
-
you, sir, are my hero
-
1. because the objects on the screen are changing, thus the screen is unlocked
2. not sure..although I hope after 8 months you have found these answers
-
@plflorence My questions exactly xD
-
just wondering….
1. why are we not using lock()/unlock() in this case?
2. does pygame.draw.lines draw the whole line every time? or only draw the new part that was added to points variable?
thanks a lot for the tutorial! -
Make sure to try turning it to "True." It's cool.
-
lol…I liked how he mumbled "thats what she said" very quaintly lol
-
Every time I exit with the red X, it says:
"Pythonw.exe has encountered a problem and needs to close. We are -"etc.
Not that big of a deal, though i would appreciate it if it didn't pop up every time… -
make len(points)>3 and make it True to create quadrilaterals
-
how do u have it replace the current points with the new one
-
You didn't need to lock the screen?
-
Lol @ 1:45
-
i dont get was False does…
-
"Let's tighten this up a little bit .. urr .. *that's what she said*" XD
Love your humor in your tutorials! -
I drew an awesome spiderweb with True
-
you need to create the points as a list.
-
does anyone know a way to make it so the screen will go black? cause i wanan dd it so when c is pressed teh screen will go completely balck and erase all the lines..
-
thats what she said
and now i subscribe, tang kew
-
Thank you for letting us be able to download!
-
thanks man this is EPIC =)
-
never mind
-
what language is this in?
Leave a Reply