@SuperJMN wrote:
I'm trying to use Reactive Extensions with MonoGame. I don't know if this is new or anybody has tried before me, but I'm getting mixed results.
My scenario is the following. I have a bunch of SpaceShips that drop a bomb every 2 seconds. This is what I do:
class Ship : StageObject { private IDisposable bombDropper; public Ship() { bombDropper = Observable.Interval(TimeSpan.FromSeconds(2)) .ObserveOn(Dispatcher.CurrentDispatcher) .Subscribe(_ => { if (Top + Height + 20 < Constants.GroundTop) { Stage.AddRelative(new Bomb(), this, RelativePosition.Bottom); } }); } }
The problem is that only the first SpaceShip drops bombs. Why?
Somebody told me this:
I’m a little suspicious about your dispatcher not being updated or blocking on the same thread of the dispatcher
not sure if mono game would have a dispatcher
dispatcher tends to be a very windows thingSo my question is: what's wrong with this code?
Thanks in advance.
Posts: 1
Participants: 1