New answers tagged pygame
When you click inside the window and you are not defining any state condition when the event happens it may hang. So add this condition anywhere: for event in pygame.event.get(): if event.type == MOUSEBUTTONUP: None This would tell it when you click the mouse do nothing so it will not hang. That worked for me.
You're going to have tons of questions regarding 3D math so I recommend you get the book Essential Math for Game Programmers, the 2nd Ed. I bought a copy myself and was reading it last night before bed. http://essentialmath.com/book.htm For your specific question you can use a rotation matrix to represent your object's orientation. You can concatenate this ...
you have three options: iterate through all characters and filter on weather they are in range or not (most stupid but simple to implement) search on the grid everything that is within range. requires links from the map to characters put every character in a search tree (eg kd-tree) to quickly find everything that is within range. This requires knowledge ...
You can generate a random vector with a given fixed speed by choosing a random point on the unit circle, then scaling by the desired speed: angle = random.uniform(0, 2.0*math.pi) vector = [speed * math.cos(angle), speed * math.sin(angle)] You could also choose speed randomly as well, using random.uniform(minSpeed, maxSpeed). As for the change in behavior ...
Top 50 recent answers are included