Comments (5)
Would setting ctx.scale
before drawing work?
The main problem is that only the TileEngine is set up with a "camera" setting to handle larger maps (and it's just there to tell it where to start drawing the map), but there isn't anything in the rest of the library that understands that since most of the time the library has you do everything (like when to draw things and in what order). Having a system that understands camera, viewport, and scale would need to communicate that info to every sprite and tilemap.
As such, I'm not sure it fits in the system as it would require too much interdependency. You could try making it a plugin though, or maybe a sub-system that can work with Kontra.
from kontra.
I'm not sure I quite follow. Is the idea similar to what TileMap does with its sx
and sy
properties for larger maps?
from kontra.
If I understand the request correctly, it would add an option to zoom in and out of the map by defining a custom viewport width and height.
from kontra.
So with the most recent update to the library, Sprites now understand camera positions using sx
and sy
. You can add objects to the tile engine and it will sync the camera position to the sprite so the sprite will draw itself in the correct spot even while the camera moves.
This now opens the door for viewport control as moving all the sprites would be just a matter of setting all their sx
and sy
positions.
from kontra.
Closed via #169
from kontra.
Related Issues (20)
- Link to Web Maker broken HOT 2
- TileEngine and Pointer Click HOT 1
- Cannot prevent children from rendering in class that extends SpriteClass
- Docs cut off first letter of prop description HOT 1
- Move tests to GitHub action
- Make dom nodes public HOT 1
- Vertical text alignment
- addToDom utility function should only look for direct children
- Idea: Community chat/forum? HOT 2
- Add container option to all components that create a DOM node
- Allow Sprite to draw single image from spritesheet / tilemap HOT 2
- Allow seedRand to save / load seed state
- Support padding for `SpriteSheet`
- GameLoop `tick` event not in correct place
- Allow `randInt` to accept a seeded random object HOT 3
- Allow `randSeed` to accept a number as well as a string
- Allow `randInt` to take a random function to generate the random number
- Add `preventScroll: true` to any `elm.focus()` calls
- [feature request] Pixi.js HOT 1
- Prevent multiple `loop.start` calls creating zombie frame
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 kontra.