
onefrankguy
Members-
Posts
12 -
Joined
-
Last visited
-
Days Won
1
onefrankguy last won the day on October 27 2013
onefrankguy had the most liked content!
Contact Methods
-
Website URL
http://www.frankmitchell.org/
-
Twitter
onefrankguy
Profile Information
-
Gender
Male
onefrankguy's Achievements
Newbie (1/14)
7
Reputation
-
I rewrote your Box.toRight and Box.toLeft functions. Comments are in the code for an explanation of what it's doing. // Boxes start out against the left edge of the canvas, with 25 pixels between each box.// This means some boxes may start off the right edge of the canvas.// The total length of the list of boxes is (number of boxes * (width of box + padding)).Box.toRight = function (canvas, box) { if (box.x < canvas.x + canvas.width) { // Box is on the canvas. Move it right. box.x += 5; } else { // Box is off the canvas. Move it to the left end of the list of boxes. box.x -= boxs.length * (box.width + 25); }};Box.toLeft = function (canvas, box) { if (box.x + box.width > canvas.x) { // Box is on the canvas. Move it left. box.x -= 5; } else { // Box is off the canvas. Move it to the right end of the list of boxes. box.x += boxs.length * (box.width + 25); }};
-
Jorge reacted to a post in a topic: Urgent problem, help please
-
More debugging. I'm thinking the localStorage thing might be a red herring. Sometimes it works, like if I get two gang members back to back and just let them shot me. Poking through the code to see if I can figure out why. Okay, here's something else that looks suspicious around line 1023. function window_active(){ is_enemy[this_index]=0; allow_change[this_index]=true;}The window_active() function references the this_index variable, but I'm not seeing that variable defined globally. The closest we get is an argument to the close_window() function at line 1018. function close_window(this_index){ createjs.Tween.get(win_index[this_index]).to({image:sp_window2},10).wait(animation_speed).to({image:sp_window1},10) .wait(animation_speed).to({image:sp_window4},10).call(window_active);}I think window_active needs a this_index argument, and close_window needs to pass this_index into it as .call(window_active, [this_index]).
-
Jorge reacted to a post in a topic: Urgent problem, help please
-
Ran through it again on iOS 6.1.4 on an iPhone 5. Startup time felt snappier (though that could just be image caching). Sadly, saw the same pink overlay and freeze when I got to level four and missed one of the bad guys. Took a look at the source. The only thing that seems off is around line 1039. if(typeof(Storage)!=="undefined"){ localStorage.setItem("chocolatepixel.skyscraper", hiscore);}Shouldn't that check be if(typeof localStorage !== undefined){ localStorage.setItem("chocolatepixel.skyscraper", hiscore);}
-
Jorge reacted to a post in a topic: Urgent problem, help please
-
Tested on Mobile Safari on an iPhone 5 with iOS 6.1.4. Froze after I made it to the fourth level and missed one of the bad guys. Screen got a pink tint and locked up.
-
Martiny reacted to a post in a topic: Is it worth using TypeScript?
-
If you're just looking to mimic the behavior of TypeScript's "extends" keyword in JavaScript, you can use the Object.create() function. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain
-
YellowAfterlife reacted to a post in a topic: About LeadBolt advertise.
-
dev reacted to a post in a topic: About LeadBolt advertise.
-
mentuat reacted to a post in a topic: About LeadBolt advertise.
-
How to calculate FPS in plain Javascript?
onefrankguy replied to Gustavgb's topic in Coding and Game Design
It's actually the current frame rate. The Timer.tick function gets called before the browser repaints, so Timer.elapsed is actually tracking the seconds between the last repaint and the repaint that's going to happen next. It's basically "seconds per frame", which I invert to get frames per second. I only redraw my FPS counter every second, since as you mentioned, if you redraw it faster than that it's not readable. var timer = new Timer() , then = 0function render (now) { requestAnimationFrame(render) timer.tick(now) if (now - then > 1000) { then = now $('#fps').innerHTML = timer.fps() }}I like your idea of doing an average over the last sixty frames. I'm going to have to play around with that.- 5 replies
-
- fps
- javascript
-
(and 2 more)
Tagged with:
-
How to calculate FPS in plain Javascript?
onefrankguy replied to Gustavgb's topic in Coding and Game Design
Assuming you're using requestAnimationFrame, you can do this: function Timer () { this.elapsed = 0 this.last = null}Timer.prototype = { tick: function (now) { this.elapsed = (now - (this.last || now) / 1000 this.last = now }, fps: function () { return Math.round(1 / this.elapsed) }}var timer = new Timer()function render (now) { requestAnimationFrame(render) timer.tick(now) // Get the current FPS with a call to timer.fps()}requestAnimationFrame(render)- 5 replies
-
- fps
- javascript
-
(and 2 more)
Tagged with:
-
Here's what those numbers, abbreviations, and acronyms mean. Views/Imps: 626 This is the total number of people that saw the ad in your game. The abbreviation "Imps" stands for "Impressions". Clicks: 39 This is the total number of people that clicked on the ad in your game. CTR: 6.23% This is your click through rate. It's computed by dividing the number of people who clicked on an ad by the number of people who saw the ad. Revenue: $0.09 This is how much money you've made from people clicking on ads in your game. EPC: $0.00 This is your earnings per click. It's computed by dividing your revenue by the number of people who clicked on an ad. In your case, the actual value is closer to $0.0023. ECPM: $0.14 This is the effective cost per mile. It's a guess at how much revenue you'll generate if 1,000 people see an ad in your game. It's computed by dividing your revenue by the number of people who saw an ad in your game and multiplying by one thousand. Given all that, here's what actually matters. If you're doing split testing, where you show ad A and ad B within the same time frame, you want to pay attention to the ECPM per ad. The higher that number is, the better an ad's performing. If you're just showing one ad at a time, you want to pay attention to EPC per ad. The higher that number is, the better the ad's performing. Finally, when it comes to Internet marketing, clicks are cash. You can have an ad seen by a million people, but if no one's clicking it, you're not making any money. So focus on getting your CTR up.
-
How to handle non-default fonts on HTML games
onefrankguy replied to plicatibu's topic in Coding and Game Design
If you already have the TTF, and own the redistribution and embedding rights for it, Font Squirrel will do the conversion to a webfont for you. http://www.fontsquirrel.com/tools/webfont-generator -
I like Darius Bacon's version. Mostly because it's small and up to date. https://github.com/darius/requestAnimationFrame
-
Handling features during "build time"
onefrankguy replied to plicatibu's topic in Coding and Game Design
Take a look at preprocessor.js. It supports #define, #include, and #ifdef among others. https://github.com/dcodeIO/Preprocessor.js -
Assuming your Voronoi cells are convex polygons, you should be able to do something like this: 1. Pick a cell 2. Construct two parallel lines through the cell 3. Construct two parallel lines perpendicular to the first two lines where the first two lines intersect the cell 4. You've now inscribed a rectangle in the cell 5. You've also divided the cell into five or fewer pieces 6. Repeat from step 1 for the pieces of the cell that aren't rectangles 7. Stop when the generated rectangles get too small That'll give you large rectangles in the center of your cells, with smaller rectangles packed around the edges.
- 3 replies
-
- polygon
- tesselation
-
(and 2 more)
Tagged with: