-
-
Notifications
You must be signed in to change notification settings - Fork 647
inViewport broken since moving SpriteObject to renderable property #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
…isibility test. Thanks Chris Lau! - inViewport is broken since moving SpriteObject to the `renderable` property (#176)
hmmm good point .. what about just simply move the |
As long as we can reasonably expect all "viewable" things to inherit from |
@parasyte all viewable things are supposed to inherit from the new note however that a few ones are not yet inheriting from it, like the infamous HUD object/items ;) |
There's a Since |
yep, I added But I was thinking, shall |
@obiot True! The same could be done for
|
@parasyte wow, when I just read that, I just thought “what it does not inherit from |
This is becoming a little more work than I imagined when I discovered the bug. ;) But better to get it all cleaned before release. |
…nderable` and changed `me.ObjectEntity` to inherit from `me.Renderable'
@parasyte Shall we also move Also, we should also rename the Ultimately, it would be nice to re-organize the whole library using something like require.js, as we would not need to do this kind of hackish ordering requirement (i guess that would deserve its own ticket) is it me, or the more we do, the more there is to do ? :):):) |
@obiot Wow! core.js is much smaller now! :D I think The On require.js; I don't have many opinions about it. But I did recently read an interesting article by Mishoo (Uglify-JS author) on the subject. Have a look: http://lisperator.net/blog/thoughts-on-commonjs-requirejs/ I get the impression there's no magic bullet for the dependency issue; either you stick to loading everything in a specific order, or deal with callback horror! But yeah, I think the problem with refactoring is that it's a lot of work for little visible gain from a user's perspective! ;) |
@parasyte wow, very good article, even made me laugh a couple of times :):):) so I then will move |
…er` to inherit from `me.Renderable`
…y inherit from `me.Renderable` - Also make other TMX classes inherit from `me.Renderable` - Fix `inViewport` property - Change platform example to use `inViewport` to detect falling off the screen, instead of checking object position.
@obiot That pretty much solves the ticket! (yay! teamwork!) The last patch was a massive change that also impacts some established API. ( I added this info to the Upgrade Guide. |
@parasyte wow, yep great work you did on this one as well I must say, although I'm a bit scared by the very last one as I'm seeing a loooootss of changes :) |
about this I'm not sure I'm really happy about this one to be honest, as I had in mind to use pos (later) to allow positioning an initial image somewhere that at the (0,0) origin position. think about a repeative background much less higher than the current level height that you want to be bottom aligned ? |
@obiot I see. Would that be expected to work with the |
@parasyte actually with or without, could be a fix background (some "header" or "footer" background with some fancy elements) or a repeatitve/parallax one. But yeah, for sure i'll give it a try :) Else I just reviewed the changes you made and that you renamed width/height to cols/rows and realwidth/realheight to width/height.... and I don't know... I mean having the layers itself in mind, width and height are then coherent compared to the property/variable named used by TIled, on the other hand, this is not coherent with other width/height property used in the engine (viewport widht/height to start with). in the mean time, this is also internal stuff, and not really visible for the "end-user' so.... |
@obiot Do feel free to revert these changes. I felt it made sense to make the It is a big change and prone to error, though. :( |
@parasyte no no, actually having width (or height) being the width in pixels, fully makes sense at least compared to other element/components of melonJS (entites width are in pixel not tile), it's just that effectively big changes are prone to error :) makes me things that while we are at breaking stuff, what about all these setTile, getTile function you once "complained" about ? on my side, i keep progressing on the texturepacker stuff, I should soon have some beta version with animation support :) |
@obiot Oh yeah! I had forgotten about getTile and setTile. I think there's still a ticket for that. On texture packer: sounds great! I should probably familiarize myself with the tool. Currently I don't know anything about it. ;) |
Texturepacker is quite good actually, or more specifically what is good is that you don't really have to worry about your sprite size, etc... just drag&drop them into the software and basically it will gives you back a big PNG and a corresponding atlas with each sprite size and position. Of course the big big advantage is that you end up with a power of 2 size optimized texture (instead of having all your single PNGs being sized up to match the next pow2 value and waste, specially on mobile devices, considerable amount of memory for nothing), that's quite good, specially when targeting cocoonJS. I don't how much you played with it so far, but checking the console log is kind of scary :) |
…nd added proper documentation for it
i'm closing this one, as I think we are done with it :) |
@obiot
Some code within core.js expects to act upon objects that are defined as sprites. The move away from
ObjectEntity
inheriting fromSpriteObject
means this code no longer works as expected. One example is theinViewport
property. (Also the dirtyRegion feature.)I suppose a fix would involve a new property
isEntity
for objects inherited fromObjectEntity
, right? I don't really like the idea of having all of these class-specific properties. Another option is atype
property which is an array of strings identifying the object class hierarchy.e.g.
With that, the
if (this.isSprite)
can be replaced byif (this.type.indexOf("me.ObjectEntity") >= 0)
Iterating arrays like this is kind of slow, though. :(The text was updated successfully, but these errors were encountered: