Thanks alot!
I'm not really trying to acomplish anything with this code in particular, just used it as an example to find out how this could be done.
User Profile
Collapse
-
Using methods of other classes in a class
I want to know how I can (in a class) use another class' method.
Here's an example (which is not working):
Code:class A: def __init__(self, x, y): self.x = x self.y = y class B(A): def __init__(self, x, y, z): self.z = z def add(self): result = self.x + self.y + self.z class C(B): def __init__(self,
-
Used that code and added
self.init_mover (dx=0, dy=0)
and it works perfectly.
Thanks man!Leave a comment:
-
Moving an object by user input
I'm looking for a tutorial (preferably with livewires) or some sort of documentation on how to control an object with user input.
Basically what i want to do is move an object with the arrow keys.
Any suggestions? -
-
Thanks for the tip, it took care of the runtime error.
I've played around a bit more and now i have another problem.
I get the following error:
Traceback (most recent call last):
File "...", line 54, in <module>
game()
File "...", line 47, in game
def_safety = Player('defense ',(40, 40))
File "...", line 36, in __init__
...Leave a comment:
-
Runtime error when starting a game.
All i wanna do at this point is to test the (soon to be) game and see that the correct sprites are were they are supposed to be.
When i run the game the background is black instead of the green color of my field.png, no other sprites are visible and after a while i get a Runtime error and the game crashes.
Any ideas?
Code:import pygame, math, sys from pygame.locals import * from livewires
-
-
Need help creating the union of two lists (help a noob)
I'm trying to create a function which would look like this when running:
>> union([1, 2, 3],[3, 4, 5])
[1, 2, 3, 4, 5]
>> union([1, 2, 3],[])
[1, 2, 3]
I have written the following code:
Code:def union(l1, l2): finalList = [] i = 0 j = 0 while i <= len(l1): while j <= len(l2): if l1[i] is l2[j]:
No activity results to display
Show More
Leave a comment: