Jump to content

Camera?


Bizzi
 Share

Recommended Posts

Hey :)

Yesterday i have found Phase, REALLY REALLY GREAT! Its really easy :D

I have a Problem:

On the examples is a TiledMap and a ScrolingCamera example...

How i combine that?

Problem is:

The "Player" will only following on the Map on the TileSet Example. If i going to the end of map, the player will be hidden. That problem is on the Scrolling Map example not.

i hope you dont understand me, im not really speak perfect english.

Were is the Documentation about Phaser - Not found that.

Link to comment
Share on other sites

There is a command: Camera.follow that allows the camera to follow a Sprite. So as it moves around the map the camera will follow it.

 

The camera has a bounds value. This is what is used to control how far it can move around the world. If the camera bounds is smaller than the world size then the camera would stop moving even though the world or sprites may carry on. Have a look at World.setSize() and camera bounds to make sure they are both the same size.

 

Documentation is coming in the 1.0 release, I promise :)

Link to comment
Share on other sites

Thanks for your answer :)

Hmm, its not that wat i need.

On the ScrollingZone, the "Player" are centered, the Map will be moved if the player moving. The Scrolling zone is endless.

I need the Tilemap with the feature by scrolling zone - endless and the player are always centered.

i have try to experimented with the camera options inter alia with the following method/function. but I do not get the desired result.

Before i used Phaser, i have created an example only in Javascript, checkthis out: http://k-fuckz.net/subs/flight/

Link to comment
Share on other sites

The moving on the example was not implemented yet.

Yes i know - Tilemaps cant be endless. but it is not possible to combine both? i mean,..

the tilemap will be moved regardless of whether the player goes over it?

Can you following me?

EDIT:

I have an idea. I copy with the tilemap and make an additional plugin. then I change the functions and take the place out, where it is said "not scroll further."

Link to comment
Share on other sites

Set your player sprite to have a scrollFactor of 0,0 so it doesn't get influenced by the camera and position it in the middle of the screen.

 

Then just move the camera around the world rather than trying to move the map itself. The player will stay fixed in the middle then regardless (as long as you don't collide it with the map).

Link to comment
Share on other sites

I don't really understand what the problem is to be honest. scrollFactor is a valid sprite property in 0.95, so it must be something else in the code elsewhere causing it to be wrong.

 

 

How i can call to the game "please render" if the window are resized?

 

?

Link to comment
Share on other sites

Ok, a little bit simplier: i have created a TiledMap object.

Default is: If the player moves, the map will be following.

What i search is:

The Player Spirte will be centered on the Game - These only rotating.

The Map will move and not the player. Example:

function render() {// Keyboard...var speed = 200;var motion = this.game.motion.velocityFromAngle(this.airplane.angle, speed);// EXAMPLEthis.map.setPositionTo(motion);}

For the "resizing":

If you resize your window, the game not update that.

Can i update the size after "setup"?

Example:

window.onresize = function() {// Update game size,...MyGame.setSize(window.innerWidth, window.outerWidth);};
Link to comment
Share on other sites

Tilemaps can't be endless right now. Technically what you need (I assume?) is for a tilemap to wrap at the edges, as by its nature a tilemap couldn't really be endless.

 

There is a concept from impact.js that you can specify a small tilemap to be repeated (like the tiled wall paper) which provide an "endless tilemap". I guess that's what Bizzi want, or something like that.

 

Actually I have no idea of how this be useful, maybe for some special art style?

Link to comment
Share on other sites

Ok, you can't apply a velocity to a tilemap. What you need to do is move the camera, not the map. If the sprite has a scrollFactor of 0 it will remain fixed in place.

 

As for the window resizing this is handled much better in 1.0 but you can apply css to the canvas to get it to scale to a % size, then it will match the browser window as it changes.

Link to comment
Share on other sites

About the resizzing:

I have read that there methods are implemented to a non-stable (0.97)?

i have try to use 0.97 - ich check for afternoon the source for the methods. yesterday i have setup my project for 0.97.

And yes, PixelPicoSean, that is it! a "endless" tiledmap.

My ideas for them: A Gorund like ScrollZone there scrolling endless, and above the Tiledmap. On the tiled map can use collisions to say to the player "here is the map end"...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...