tags:

views:

44

answers:

0

In particular, I'm trying to Kill a Sprite using SDL.NET. The sprite is, for example, a shoot which move from X=10 to the end of the screen (X=1024) for example. After 1024 I would like to kill it ! According to the documentation of Sdl.NET, into my class definition, on event Update, I write

public void Update(...) {
...
this.X++; // the shot from left to right
if (this.X>1280 || this.X<0 || this.Y>1024 || this.Y<0) 
   this.Kill();
....

The problem is that I think my object isn't really destroyed, because sometimes... the shot disappear from left, and return from right (after some times). I think after arrived to 32565, it restart from zero so it reappear on screen...

So: is it possible to destroy the object calling the Kill method INSIDE the object ?

Thank you!