Game Development Tutorial – 11 – Line Drawing Program

[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –


Posted

in

by

Tags:

Comments

27 responses to “Game Development Tutorial – 11 – Line Drawing Program”

  1. Harsh Rajmachikar Avatar

    That's what she said…
    man i wish i could subscribe twice…you're the best

  2. Uwais Ishaq Avatar

    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()

  3. Pimpcat Forthelols Avatar

    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

  4. Paul Lee Avatar

    you guys should try , True instead of false, I think it's faiirly cool.

  5. o kos Avatar

    ok i saw what happened when replaced true instead of false.but why?

  6. TheRyeguy35 Avatar

    I got the invalid syntax error with the 'points=[]' list

  7. Holtzy944 Avatar

    you, sir, are my hero

  8. Charlie Barkley Avatar

    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

  9. minidude22 gamer Avatar

    @plflorence My questions exactly xD

  10. plflorence Avatar

    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!

  11. Vazeroth16 Avatar

    Make sure to try turning it to "True." It's cool.

  12. drewlark99 Avatar

    lol…I liked how he mumbled "thats what she said" very quaintly lol

  13. Squirgenheimer Avatar

    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…

  14. The Art of Dota Avatar

    make len(points)>3 and make it True to create quadrilaterals

  15. Khamraj Rohit Avatar

    how do u have it replace the current points with the new one

  16. wolterh Avatar

    You didn't need to lock the screen?

  17. Matthew Avatar

    i dont get was False does…

  18. gorogawa Avatar

    "Let's tighten this up a little bit .. urr .. *that's what she said*" XD
    Love your humor in your tutorials!

  19. thrasher729 Avatar

    I drew an awesome spiderweb with True

  20. Life is a Game Avatar

    you need to create the points as a list.

  21. Bubbletankking Avatar

    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..

  22. Curran Sherrill Avatar

    thats what she said

    and now i subscribe, tang kew

  23. stachuk1992 Avatar

    Thank you for letting us be able to download!

  24. Amir Zamli Avatar

    thanks man this is EPIC =)

  25. InsideInsanity Avatar

    what language is this in?

Leave a Reply

Your email address will not be published. Required fields are marked *