Working with pointers in game logic function