Closed unknwnc closed 9 years ago
I've also made some modifications to the game engine. I did my best to streamline some of the code- got rid of some unnecessary functions, removed some duplicated code. I made some edits to the fps object as well. Everything related to fps is now stored in the fps object, and I made minor optimizations...
For some reason it doesn't allow me to do the merge pull request. It says I must use the command line to resolve conflicts before continuing.
I can copy and paste this.loop
function so it will use animation request
You can compare the files to see the changes I made...
I made several changes through the game engine, and a small change in main.js.
The change in main.js has to do with how I changed the game.fps
object, so game.fps
is an object and the current framerate is stored in game.fps.current
.
I believe it can't automatically merge because we both modified the same file, so GitHub doesn't know which version to keep. Are you familiar with using GitHub on the command line?
Here is an article about resolving merge conflicts: https://help.github.com/articles/resolving-a-merge-conflict-from-the-command-line/
I'll wait until you can resolve my pull request before doing anything; Then we can both make sure we're using the same code, and we're working on different things.
Try this. Pull down the latest version of the code and reconcile your code with mine then resubmit it. Do you think that will fix it.
I can give it a shot. Try reading that article on resolving conflicts, though, in case this happens again...
This article made more sense to me. http://blog.michelemattioni.me/2013/01/29/what-do-i-do-when-my-pull-request-does-not-merge-automatically-in-master/
If it makes sense, can you pull it?
It says I should create another branch to test the code.
Yeah, I realized that too... Looks like neither of us should be developing on gh-pages.
I looked closely at your commits, and I think I found the place where it's having an issue...
It looks like you copy my game.loop
function, and I remove a comment, it will be able to merge automatically.
I created a branch called feature. Not sure how I add your code or reconcile it.
I added the animation request frame code to the main branch cause I couldn't figure out how to merge it. I guess our files are too different to merge. The difference is probably found in fps
. You made everything that had to do with fps
public by adding this
to it. And I had the stuff that didn't need to be public private.
Here is a good video on pull requests
You also don't have the fps updating the display every second. That makes it easier to read the fps display.
I noticed your game library uses
setInterval
for the main loop. I changed it to userequestAnimationFrame
, an HTML5 feature that syncs javascript with screen refreshes. This theoretically allows the game to use less CPU, and provides a more stable frame rate (It's now steady around 30FPS for me).More about
requestAnimationFrame
: https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame