Comments (9)
good find! .. actually your demo works just fine in both latest chrome and ie9 but fails (failing as in list[0] contains element1) in firefox 9 (and I assume earlier versions as well).
But of course it needs to work in firefox as well. Do you think some simpler patch is possible to solve this issue, maybe setting list[x] to undefined manually where it matters? Probably a bad solution though.
A patch from someone who spent time digging into the issue sounds very good in my ears :). I would most certainly accept it.. some tests for this would kick ass as well. I wouldn't mind having the internal array be called sprites.. cause what does a SpriteList contain if not sprites :). Also let's try not to break any documented APIs.. but I don't think that should be so hard.
from jaws.
Heh, that was my first thought too -- calling 'delete' so that list[x] is set to undefined.. and then wrapping the draw() invocation on each sprite in a if(this[i]) { this[i].draw() }
.
(Also, I was /wondering/ if this might be a browser-specific issue, too! I see)
But.. I mean, if the language protests against subclassing Array, then fine, let's not. Let me get a patch together (with unit tests, definitely), see what you think.
from jaws.
I copy on the internal array being called 'sprites', btw. :)
from jaws.
Oh hey, question. Do all the current unit tests for jaws pass for you, for all browsers? (I'm working on adding some, to deal with the array issue right now).
All of the current ones pass for me in Firefox 9, but I'm getting failures in Chrome 16 and IE 9 (on windows)
from jaws.
works 100% for in me in chrome.. in ie9 and ff there was some kind of race condition producing a lot of errors, I think I fixed it now.
I only get one failing test in ie9/ff now, and that's "audio loaded".. not sure why the .wav-file isn't loaded correctly just yet.
from jaws.
Question. In sprite_list.js, in the constructor:
jaws.SpriteList = function SpriteList(options) {
if( !(this instanceof arguments.callee) ) return new arguments.callee( options );
What is that second line (re arguments/callee etc) for? I think I understand what it's saying, but what situation does it come useful in?
from jaws.
it makes both sprite_list = new SpriteList() and sprite_list = SpriteList() work
.. basically it will make the constructor work without "new". arguments.callee is just a more general way of writing SpriteList.
from jaws.
One more - what's your policy on tabs vs spaces, in contributed code? (tab chars ok, or do you want '2 spaces' tabs, or what?)
from jaws.
2 spaces
from jaws.
Related Issues (20)
- Cannot rotate sprite properly HOT 6
- More SpriteSheet flexibility HOT 1
- Feature? Delete from TileMap HOT 3
- PixelMap 'tainted cross-origin data' in chrome 25 HOT 2
- Rotate viewport HOT 7
- Question: how to use jaws.Text? HOT 2
- nevermind
- Gamepad support, multiplayer considerations? HOT 3
- jaws.Assets() Arrays vs. Objects
- Question: Setting a sprite's color to an RGBA array instead of a named value
- Please replace the word "Fuchia" in your files (assets.js?) with the correct "fuchsia" (with an S). HOT 1
- Add project Jaws in Bower (A package manager for the web)
- html character encoding
- About the viewport bound HOT 2
- numpad0 keycode missing HOT 2
- Feature request: tilemap ROW and COL returned
- Sprite.setImage doesn't take into account scale_image HOT 1
- Setting the frame_direction property of an animation to -1 causes the animation to loop on the first frame. HOT 2
- jaws.Parallax.add_layer use jaws.Parallax.prototype.default_options.layers HOT 3
- Feature Request: Text Support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jaws.