Skip to content
This repository has been archived by the owner on Nov 13, 2020. It is now read-only.

Updated movement by polling to achieve smoother movement #29

Merged
merged 7 commits into from
Aug 20, 2012

Conversation

derek-smith
Copy link
Contributor

This removes the delay imposed by the browser/OS when a user holds down a movement key. This works by polling and tracking the movement keys. Right now it's set to check every 100 milliseconds. Tested in Chrome and Firefox in Ubuntu. This also limits the speed of the character to the polling interval. This is pretty simple and perhaps not ideal, but should give you an idea :)

Derek Smith and others added 5 commits August 17, 2012 16:32
Movement is handled by polling to avoid the default
delay that the browser/OS' use before repeating
held-down keys.
… to die. Added basic AI to enemies - they chase players if within a 10 tile radius. Lastly, changed the enemy movement interval to 1sec from 4secs to make things more interesting :)
@derek-smith
Copy link
Contributor Author

Wow, I think I'm going about this pull request thing the wrong way.

The first pull request I did that you merged was the first one I've ever done. I didn't realize I could commit to this pull request and you'd see it :) So basically I was just hacking away not meaning for you to use it lol.

Having said that, your recommended changes make 100% sense and I'll fix and commit shortly.

I really need to read up on pull requests, branches, and the basics on shared code development. I mean, what if I add a feature that I like, but you don't necessarily see as a good addition to your code base?

Lastly, are you going to continue coding this game? Should I continue doing pull requests? I will probably be hacking on it here and there.

Derek Smith added 2 commits August 19, 2012 19:45
Re-factored the heart drawing code to cache the jQuery object.
@derek-smith
Copy link
Contributor Author

OK, so I've made those changes.

So like I said I'm just hacking because it's fun :) which means my code could be better!

Downside of the way the hearts are handled: it's all client side, but I'm sure you noticed that. Not ideal.

@tlhunter
Copy link
Owner

I'm new to pull requests too ;)

I do plan on keeping this game alive. Some of my projects are abandoned, but this one is just too fun to give up on.

I agree, the hearts should be server side. There will eventually need to be a huge rewrite where inventory, health, positions, terrain modification is all made server side. But for now, it's just a fun little game, let the hackers hack.

tlhunter added a commit that referenced this pull request Aug 20, 2012
Movement key polling, health, simple NPC AI
@tlhunter tlhunter merged commit 1fa9133 into tlhunter:master Aug 20, 2012
@tlhunter
Copy link
Owner

Some bugs came up from this pull request:

#21 (comment)
#24 (comment)

I was wondering if you wanted to tackle them?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants