I object oriented your code #1

merged 32 commits into from Jan 29, 2013


None yet

2 participants

avindra commented Jan 28, 2013

Hey, it's avindra from reddit. Thanks for linking your project. It helped me understand canvas. I decided to rewrite whole parts of it so that I can understand it and get this code looking up to date.

Also, I fixed the monster animation, look how smooth it is :D

avindra added some commits Jan 28, 2013
@avindra avindra First wave of optimizations.
use a switch(){}, adjust indentation
@avindra avindra Remove a net of about 200 more lines of code by condensing.
Compress all PNG images. Delete DS_stores.
@avindra avindra Rework stepping, net change of -81 lines. 1e20147
@avindra avindra Remove old code for stepping condensation. e43a232
@avindra avindra Condense hero stepping functions for the first time. 8d35f9d
@avindra avindra Ugly but functional condensation of arrest() function. e2482ec
@avindra avindra Remove about 400 lines of code by keeping the state in the eStepSwitc…
…her() class.
@avindra avindra Implement step switching function for hero as well as monsters. Renam…
…e hero images accordingly. about 100 lines removed.
@avindra avindra Create Monster() class. Store all monsters in an array, make code eff…
…icient accordingly.
@avindra avindra Move bounding information into relevant objects for each monster. Del…
…ete some unused variables. Fix indentation.
@avindra avindra Tidy indentation and hedge generation code. 3d4f5a6
@avindra avindra Fix a variable naming inconsistency on monsters[3] 622ab7b
@avindra avindra Condense all monster animation into one function. Almost 400 lines re…
@avindra avindra Trim monster grid code. Can possibly use a further optimization by on…
…ly checking the arresting officer.
@avindra avindra Shrink arrestation function by utilizing "spotter" variable. Shrink h…
…alt image code using "spotter," too.
@avindra avindra Load monster patting and spawn locations from an array. a0b1a2e
@avindra avindra Create archer class. Will add arrows to this class later. 4bbbd9f
@avindra avindra Implement inheritance, remove all instances of hero animation code. 03ec958
@avindra avindra Transfer all movement code into common functions. 392d5ac
@avindra avindra Store aim variables in relevant objects for each monster. 5515375
@avindra avindra Apply consistent line breaks to arrest code. 3def06f
@avindra avindra Fix glitchy enemy / monster movement by delaying each step by 150 ms. d0fd989
@avindra avindra Remove animate() function. All animation is now done automatically wh…
…en a move is requested.
@avindra avindra Apply inheritance to Archer(). Create class for Arrow() d12db86
@avindra avindra Delete heroImage / heroReady. Move monster animation variation to the…
… Monster class.
@avindra avindra Move monster related code in reset() to mRespawn(). 4089c03
@avindra avindra Remove direct (duplicated) calls to step() in the hero handling funct…
@avindra avindra Combine logic for two monsters that have the same behavior. Remove te…
…mp files from repo. Todo: rework monster pathing.
@avindra avindra Optimize map painting activity. c09cfaa
@avindra avindra Optimize archer logic code. cbafb3c
@avindra avindra Remove redundant condition in else. 8249ab4
@avindra avindra Move speech bubble code into Monster() class. General cleanup. 22726d2
@Aslan11 Aslan11 merged commit 8467b15 into Aslan11:master Jan 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment