Creative Pact Day 3: Knocking Things About


Result – this is actually game-like!

CatFishTron Creative Pact Day 3

Today’s lesson in that things are always more difficult than they seem.  Tried adding a MotionEvent.ACTION_MOVED detector to the onSceneTouchEvent() method of my TouchSprites so they could detect when a finger dragged over them and subsequently would knock them about, but had a bit of trouble.  Apparently, as I’ve learned on the excellent AndEngine forum, an object needs to first catch an ACTION_DOWN event before it will start to receive subsequent ACTION_CANCELED or ACTION_MOVED events.  This makes sense in hindsight, but it also make things a bit more difficult when you’ve started thinking about it from the other way, as if these events were just globally propagated down the chain of objects that are subscribed to receive them, until one steps up and handles it.

The solution is to create another physics object that’s hidden, and move it about to knock the other objects around when necessary.  Also, I had to update it in a different thread, and I still get some crashes occasionally due to memory errors.  Need to look at those…

So it looks like “kicking” an object (a cat, in this case) is going to be all I can get done today, because tonight is the opening at The Brick Box in Brixton Market and I’ll be showing Drawn Together there amongst some other visual and artistic goodness.

I did add simple scoring to this version – this should be handled by a GameLogic class, which I’ll work on a bit tomorrow if I get a chance (have some other stuff to do).

Here’s today’s code.

Here’s today’s app. (I overwrote yesterday’s, because, well, it sucked)


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.