Coder Social home page Coder Social logo

Comments (2)

ippa avatar ippa commented on August 28, 2024

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.

ftvs avatar ftvs commented on August 28, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.