jdf / Processing.py-Bugs

A home for all bugs and feature requests about Python Mode for the Processing Development Environment.
41 stars 8 forks source link

Setting a stationary objects position to a moving objects current position forever updates the stationary object #253

Closed WackeyTech closed 5 years ago

WackeyTech commented 5 years ago

I have an object that I want to stay stationary and when it is created I want it to 'spawn' on the current position of a moving object, but the stationary object starts moving with the moving object. For more context I want to spawn a bomb on the position of a player and have the bomb sit there, but the bomb begins to move with the player. Here is my code for the bomb object: `class Bomb: def init(self, pPos): self.pos = pPos

def draw():
    fill(0, 255, 255)
    stroke(0, 255, 255)
    ellipse(self.pos[0], self.pos[1], 12, 12)

and the object is create simply like: bomb = Bomb(player.pos)

Then in def draw() I simply run the bombs draw function, but the bomb keeps moving with the player.

WackeyTech commented 5 years ago

So I think the program may be accessing and applying all physics etc. to all objects at the players location, is there a way I can fix this maybe? Or should I just offset the bombs position when spawning?