Game Development Tutorial – 15 – Beginning Vectors

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


Posted

in

by

Tags:

Comments

42 responses to “Game Development Tutorial – 15 – Beginning Vectors”

  1. kevin Romero Avatar

    any possible errors you might get are fixed when you do this: for print self.diff change it into print (self.diff) and for object() takes no parameters error, you need to put two of these _ in front and after init, so you're probably putting this _init_ instead of this __init__

  2. Yellowknight888 Avatar

    I wonder why the class is created this way (with "object" as a parameter)? Why not writing something like this "class vector (x, y):" and "thing = vector (a, b)"? I am new to python, so there might be some advantages I am missing used by the instructor

  3. Svarog Avatar

    4:01 he said fucktion 😀

  4. Jialin Li Avatar

    hi, i did all wat you sey :
    class vector(object):

        def _init_(self, list1, list2):
            self.diff=(list2[0]-list1[0], list2[1]-list1[1])
            print (self.diff)

    a =(20.0, 25.0)
    b =(40.0, 55.0)
    thing=vector(a,b)

    but in the shell appeared:

    Traceback (most recent call last):
      File "F:/Jialin/Jialin Python/Pygame/Pygame 12/Pygame 12.py", line 10, in <module>
        thing=vector(a,b)
    TypeError: object() takes no parameters

    ?????
    please help me!!

    ps: my englissh is not good!!!

  5. uibis Avatar

    Also for all who don't know. () = Tuple ,[] = list, {} = Dictionary, set([]) = set.
    tuples are not mutable. you can not take a= (1,2) and do a[0] = 2

  6. uibis Avatar

    Just to clarify: Methods are Functions inside classes.
    Methods can be called from other classes.

  7. Danny Ryan Avatar

    You need your parenthesis in the version I used (3.2)

    print (self.diff)

    Or you get a syntax error.

  8. Cosmik Debris Avatar

    It's amazing! I must've gone over my code a zillion times making sure that I'd copied everything exactly. I was convinced it was the same when all of a sudden I spotted something!

    I didn't put a 1 after list.

    So now it works fine!

    Phew! Thank god for that! I couldn't continue until this worked…

  9. Cosmik Debris Avatar

    Great tutorials!

    Everything was going well till I got the error I've just mentioned.

    Thanks, you've been really helpful!

  10. Cosmik Debris Avatar

    thing=vector(a,b)

    gives me an error, any ideas?

  11. Xyrin Avatar

    I think he was referring to subscribers.

  12. OmegaCraftable Avatar

    There is only 20,000 views on the video…

  13. EpicCommentary101 Avatar

    I like this way of answering.

  14. EpicCommentary101 Avatar

    I like this way of answering.

  15. LOKI123ification Avatar

    print in 2.7 != print in 3.1 || print("blaaaa")

  16. Rahul Shetty Avatar

    Great tut.. But at least let us know that this is the continuation of wxPython.. You could ve named you tuts laddat

  17. dashbyictfd Avatar

    solved it

    print (self.diff)

  18. dashbyictfd Avatar

    I get invalid syntax. I am using Python 3.1 IDLE. self is highlighted
    class vector(object):

    def __init__(self, list1, list2): # initialisation – calculates distance from point a to b
    self.diff=(list2[0]-list1[0], list2[1]-list1[1])
    print self.diff # self is highlighted here

    a=(20.0, 25.0)
    b=(40.0, 55.0)
    thing=vector(a,b) # Passes through class

    Can someone advise as to the issue with this code for this version Python 3.1.1.

    Thanks

  19. Mc Stevens Avatar

    "You are going to need this when working with 3d!" Well yeah if you have coninued the fucking series -.-"

  20. Bomber Avatar

    cooollllll!

  21. Amine Zyad Avatar

    object is not a parameter here, it's about inheritance from object class :/

  22. nope nope Avatar

    thanks for all the videos, i've been following your pygame videos for the past few hours. much appreciated!

  23. TheNuthog Avatar

    the diff is slope formula 😀

  24. Gabriel Avatar

    i could keep up with the videos until now, then you suddenly start classes. I guess I should go learn oop and get back here later…

  25. Guru da Ciência Avatar

    You are my new hero

  26. Jannick Nordsted Avatar

    what shall i do? im running ver.3.2.2

  27. Jannick Nordsted Avatar

    File "C:/Python32/beginning vectors.py", line 4, in __init__
    self.diff=(list2[0]-list[0], list2[2]-list1[1])
    TypeError: 'type' object is not subscriptable

  28. liizzset Avatar

    @fafase Thanks for pointing that out. it really helped

  29. gatoo23 Avatar

    @potissimus On the first one he said "What's up everyone?", lol!

  30. xXIShadowMonkeyIXx Avatar

    2 people failed and blew up their computers!

  31. Code-Dependent Avatar

    It's your fault you have so little views.. you make your tuts so clear and memorable that I never have to come back and watch it again.

  32. 4daystoriseagainst Avatar

    This would have helped a year ago when I took my first geometry class. distance formula anyone?

  33. UnchainTheNight1 Avatar

    I'm gonna have to go study about classes now lol

  34. AShiftyDealer Avatar

    @theDUTCHscripter TY VERY MUCH

  35. fafase Avatar

    @dargonight he is using python 2 and you are using python 3, meaning you need to place brakets around the print function.
    print (self.diff)
    And tadaaaa

  36. fafase Avatar

    I can't believe some of you spend 10 sec posting "Is there a space between def and __? " When it takes 2 sec to check on your IDE.

  37. HeavyPixelGames Avatar

    Guys, its def __init__ WITH A SPACE BETWEEN DEF AND THE UNDERSCORE!!!!!!

  38. ben1996123 Avatar

    @BRCoinn

    did you put a space after def?

  39. BRCoinn Avatar

    hey um… im using python 2.6.6 on mac
    and it doesnt know what def__init__ is
    help please?

  40. BRCoinn Avatar

    i made an acc just so i could subscribe ;D
    your the best bucky

  41. BRCoinn Avatar

    1:18 I aint going to class i just got out of school!!! >:(

Leave a Reply

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