Comments (2)
Thanks for the detailed feedback! You make several good points.
Private variables
The private variables x/y was a major (and hard) design decision for me. I wanted the speed of direct properties. Especially for something you might modify a lot like x/y. The problem is, as you point out, other things that depend on x/y also needs to be updated. I was thinking of using the new setters/getters but skipped them cause of not enough support + not as fast as normal properties.
To a small degree Sprite has the same "problems". Where it's possible to directly do for example "sprite.image = an_image;" but the recommended way is using sprite.setImage(an_image) since then jaws can run code to recalc the bounding box and so on.
What I ended up with in the Sprite-constructor was Both ways. There's (chainable) setters for everything. But you could also go low-level and modify for example x and y directly if you want. I haven't decided yet if I should dump the priv var access and go 100% with chainable setters. Or at least rename all private variables, so it's sprite._x = 100 instead sprite.x = 100 .. as an extra security measure but also point out "Now you're modifying something private!"
Jumping mid air after walking off a ledge
This could be considered a bug, but also a feature ;). I've found in my pixel-perfect games (see www.ippa.se) that it's actually pretty fun being able to jump midair. It makes for some "I'll never make this jump... ooh I made it"-moments.
Rect.js function parameters
True. I don't wan't to break backwards compatibility. It's probably possible to support both the old x,y,width,height and a new object-argument though... pull-requests are welcome ;).
Examples index.html
Good idea, I'll see what I can do here.
Offline development
Right.. I have no ideas how to solve this now though.
from jaws.
Thanks for the response, ippa. That clarified things.
sprite._x sounds like a decent idea. At least that communicates somewhat that it's supposed to be private.
Thanks.
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.