问题
I'm making an HTML5 game and I'm new to this, My issue is that I'm making a 2D game and I have a background that is bigger than my canvas.
I need that when my main object moves the camera moves with it so new background parts appear? But also that the rest of the objects disappear when required.
A little example will be
http://www.realmofthemadgod.com
Thanks
回答1:
Here is a good example from Simon Sarris:
jsFiddle link
Ignore the line below - posting a jsFiddle link requires accompanying code - which is too long to post!
var showFiddle = true
来源:https://stackoverflow.com/questions/16972710/html5-canvas-follow-object