[ad_1]
Facebook –
GitHub –
Google+ –
LinkedIn –
reddit –
Support –
thenewboston –
Twitter –
Game Development Tutorial – 15 – Beginning Vectors
by
Tags:
Comments
42 responses to “Game Development Tutorial – 15 – Beginning Vectors”
-
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__
-
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
-
4:01 he said fucktion 😀
-
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!!!
-
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 -
Just to clarify: Methods are Functions inside classes.
Methods can be called from other classes. -
You need your parenthesis in the version I used (3.2)
print (self.diff)
Or you get a syntax error.
-
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…
-
Great tutorials!
Everything was going well till I got the error I've just mentioned.
Thanks, you've been really helpful!
-
thing=vector(a,b)
gives me an error, any ideas?
-
I think he was referring to subscribers.
-
There is only 20,000 views on the video…
-
I like this way of answering.
-
I like this way of answering.
-
print in 2.7 != print in 3.1 || print("blaaaa")
-
Great tut.. But at least let us know that this is the continuation of wxPython.. You could ve named you tuts laddat
-
solved it
print (self.diff)
-
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 herea=(20.0, 25.0)
b=(40.0, 55.0)
thing=vector(a,b) # Passes through classCan someone advise as to the issue with this code for this version Python 3.1.1.
Thanks
-
"You are going to need this when working with 3d!" Well yeah if you have coninued the fucking series -.-"
-
cooollllll!
-
yeah…
-
object is not a parameter here, it's about inheritance from object class :/
-
thanks for all the videos, i've been following your pygame videos for the past few hours. much appreciated!
-
the diff is slope formula 😀
-
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…
-
You are my new hero
-
what shall i do? im running ver.3.2.2
-
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 -
@fafase Thanks for pointing that out. it really helped
-
@potissimus On the first one he said "What's up everyone?", lol!
-
2 people failed and blew up their computers!
-
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.
-
This would have helped a year ago when I took my first geometry class. distance formula anyone?
-
I'm gonna have to go study about classes now lol
-
@theDUTCHscripter TY VERY MUCH
-
@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 -
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.
-
Guys, its def __init__ WITH A SPACE BETWEEN DEF AND THE UNDERSCORE!!!!!!
-
@BRCoinn
did you put a space after def?
-
hey um… im using python 2.6.6 on mac
and it doesnt know what def__init__ is
help please? -
i made an acc just so i could subscribe ;D
your the best bucky -
1:18 I aint going to class i just got out of school!!! >:(
Leave a Reply