AprendizEnLaRed Posted May 27, 2014 Share Posted May 27, 2014 Hello, I have been looking for information about this but I have not found anything. There is possibility of a cylindrical world?When you pass on the width then restarts to 0. Being the world largest that the canvas?? //Sorry for my english Link to comment Share on other sites More sharing options...
oliversb Posted May 27, 2014 Share Posted May 27, 2014 Please give an example of a cylindrical world. Website looks very cool btw. Link to comment Share on other sites More sharing options...
lewster32 Posted May 27, 2014 Share Posted May 27, 2014 I think you possibly mean a world which wraps around, like Defender? If so, Phaser doesn't have anything in-built to do this (except for the game.world.wrap() function, though I don't think this will do exactly what you need) so I think you would manually have to create this effect maybe by having the player always remain at x = 0, and moving everything else in the world relatively. Beyond a certain -x or +x value, you would flip the sign (x = 0 - x) to make it appear on the other side, giving the illusion of the world wrapping without having to deal with possibly huge x values as the player moves further and further. oliversb 1 Link to comment Share on other sites More sharing options...
oliversb Posted May 27, 2014 Share Posted May 27, 2014 So Phaser does not support side-scrolling cameras or this something else that it does not support? Link to comment Share on other sites More sharing options...
lewster32 Posted May 27, 2014 Share Posted May 27, 2014 So Phaser does not support side-scrolling cameras or this something else that it does not support? Phaser supports cameras which scroll and track sprites, but the coordinates are absolute - if a player moves to the right for a long time, the x coordinate of the player and the camera just keeps increasing. In games with an unlimited sized or wrapping playing area, the best way to handle this is to move the world around the player, and wrap the objects in the world when they approach some threshold. This keeps the coordinates sane, and means you're not having to do weird things like instantly translate the positions of the player and objects near to the player, which can cause visual glitches and problems with collision etc. Link to comment Share on other sites More sharing options...
AprendizEnLaRed Posted May 28, 2014 Author Share Posted May 28, 2014 Yes, the world is as Defender. My idea is center the camera in the player that is always in the x-center of the canvas. I thought of moving in the world but do not really know how to do wrapping because have two worlds identical and concatenad i don't know if is a good idea. When the player is in world.width - window/2 if move at right... i have the right part and the left part at a time ... Link to comment Share on other sites More sharing options...
lewster32 Posted May 28, 2014 Share Posted May 28, 2014 Rather than having two identical worlds it may be easier to split the single world up into individual pieces, and have them wrap around. If you have big background images, these could be scrolled using TileSprite's ._scroll.x and ._scroll.y properties to have them endlessly scroll without moving. Link to comment Share on other sites More sharing options...
AprendizEnLaRed Posted May 28, 2014 Author Share Posted May 28, 2014 yes, its true..... I do not know how to do or how to handle enemies xD I have to study thanks pff I wanted to make a game easy to practice but this is complicating me xD Link to comment Share on other sites More sharing options...
lewster32 Posted May 28, 2014 Share Posted May 28, 2014 Enemies and AI are the part I enjoy the most! Have fun and don't give in - if something is proving to be difficult, try to simplify it down to its essential elements. If the world wrapping is complicating matters, make the world a fixed size and non-wrapping so you can focus on other parts of the game and come back to that idea later when you've learned more. Link to comment Share on other sites More sharing options...
AprendizEnLaRed Posted May 28, 2014 Author Share Posted May 28, 2014 yes, the problem is my english, I don't know how search examples in other languages hehe. Only found examples when is the player who travel off the right hand edge of the world and is then wrapped around to the left hand edge. but I'll try it . Any idea is welcome For now I think, two groups with each half of the world. In each group has enemies and when they leave to go to another group.... With the keys I move the world... and player x=0 I'll do a small test Link to comment Share on other sites More sharing options...
lewster32 Posted May 28, 2014 Share Posted May 28, 2014 I guess you're trying to do something like this? The dashed grey boxes are the groups/backgrounds, the red circles are enemies, the green circle is the player and the solid red rectangle is the screen/camera. As you scroll everything to the left, you reach a point where you move it to the other side of the world. Provided this is done outside of the screen it should be seamless and because you're usually only concerned about collisions happening around the player, the 'hitch' as you move stuff should have minimal impact. Link to comment Share on other sites More sharing options...
AprendizEnLaRed Posted May 28, 2014 Author Share Posted May 28, 2014 Yes, I'm trying it. I think that moving the halves is not complicated. I think it would be difficult, when an enemy, which also moves across the screen at different speeds, leave your half when the camera is in the cut. Then the enemy will be in the two halves together. Anyway, little by little, thanks Link to comment Share on other sites More sharing options...
lewster32 Posted May 28, 2014 Share Posted May 28, 2014 This is why I think the enemies should not be contained in moving groups, that way they can move independently and only 'wrap' when they reach the blue lines on my diagram. Link to comment Share on other sites More sharing options...
AprendizEnLaRed Posted May 28, 2014 Author Share Posted May 28, 2014 It's true, thanks for the time being I don't know upload media :S lewster32 1 Link to comment Share on other sites More sharing options...
Recommended Posts