Author Topic: How to deal with super.update() properly? (refactoring question)  (Read 976 times)

test84

  • Key Contributor
  • *****
  • Posts: 1328
  • Karma: +0/-0
  • ت
    • View Profile
    • My personal site.
Hi,

I was moving player parts of my update() code to my player class that I faced somewhere in the middle after checking keyboard, I'm calling super.update() and after that is checks for coins and stuff. So I want to move keyboard checks and coin pickups to my player class but I don't want to call super.update() from my player class, which I believe is wrong.

But if I just move those parts and call super.update() before or after calling to player.update(), my character sprite movement won't work so the super.update() should exactly be there for things to work correctly.

What should I do? What exactly happens in super.update() that it can't be moved before or after my checking code?
blog, twitter, Check out my award winning game, Rot Gut: