View Single Post
Violet CLM Violet CLM's Avatar

JCF Éminence Grise

Joined: Mar 2001

Posts: 10,978

Violet CLM has disabled reputation

Jan 9, 2014, 12:43 PM
Violet CLM is offline
Reply With Quote
Quote:
Originally Posted by Gus View Post
If you think the code can be improved and fixed, I will be more than glad to have it improved and fixed, and ofcourse include you in the credits!
A few minor points that come to mind, without trying to figure out what most of the code really does:
  • You have two longish sections of drawing lots and lots of the exact same sprite to the screen, and that could be simplified if you used loops. If nothing else, it would make it much easier to change some minor detail later.
  • While drawing skeletons, you perform the same calculations (jjGameTicks/7 and skele.xPos/32) over and over, even though the results for each one can't change in the middle of the function.
  • Look out for cases where you could use the else keyword. For instance, you have if if (issliding == 1) and if (issliding != 1) immediately next to one another, but surely they cannot both be true.
  • Your skelekill and ghoulkill variables kind of make sense, but I think the code would be simpler if you wrote KilledAGhoul() and KilledASkeleton() functions (or something like that) instead. As it is, the sample-playing and the incrementing of the killvariable take place in an entirely different part of the code. Even if you do have a good reason for this that I'm not seeing, I think you'd be better off using ++ghoulkill; instead of ghoulkill = 1;, and then while (ghoulkill > 0) instead of if (ghoulkill == 1), in case the player somehow manages to kill two enemies at once.

Looking forward to seeing more!
__________________