I’ve been doing a lot of work with timers and multiple entity spawning, as well as modifying entity attributes on the fly based on player input. It’s been very interesting - and possibly the most interesting part is that it hasn’t been that hard. Yet. That’s a very present “Yet”, just so you know. It will get harder. To get my head around what has to happen in-game I’ve been sketching and jotting things down on paper in the notebook I originally bought for GDC notes. And making small and messy diagrams of entity spawning hierarchies. The notes look something like this (I picked out the cleanest page with the least furious cross-outs on it):
Putting things down on paper in terms of entity nesting etc has helped, but in terms of math formulae I’m finding that it is easier for me to just figure stuff out straight in the code. Mind you, I haven’t gotten to any sort of overly complex calculations yet - I’m just editing timers based on user input and then calculating things like percentages for attributes based on the state of these timers.
One tricky part was entity scaling. How quickly an entity spawns not only affects its attributes, but also its size in terms of both collision box and animation. Editing the collision box was no problem - I modified it based on the prematurity attribute just like the rest of the stats:
[crayon] this.size.x = this.size.x - this.size.x * this.prematurity; this.size.y = this.size.y - this.size.y * this.prematurity; [/crayon]
this.prematurity is a real number signifying a percentage of how prematurely the entity is being spawned (eg:
But the spritesheet - changing the actual animation size - was tricky. The Impact IRC channel pointed me in the right direction to do just this: a scaling tutorial on the Point of Impact site. This came in really useful and took all of 2 minutes to implement.
The Making of Prince of Persia
I’ve been reading Jordan Mechner’s journals between coding sessions. Joseph linked me to the book on Facebook suggesting it’s something he thinks I’d like and boy am I glad he did. Reading these has been a frustrating and awesome experience. Frustrating in the beginning - when Mechner was doing anything but work on the game and kept getting distracted or demotivated. It made me want to go back in time and shake some sense into him - “You have people begging you to build a game. WTF are you doing?" But now I’m up to the entries where he has started throwing himself into POP properly and this is where the really interesting stuff comes in, like his thoughts on design and the challenge of making Prince of Persia fun as well as technical problems and solutions he encounters in the development process.
Tonight I’m polishing GUI click toggles. And hopefully finishing The Darkness II.