Search Results

Search found 6 results on 1 pages for 'parallaxscrolling'.

Page 1/1 | 1 

  • Libgdx ParallaxScrolling and TiledMaps

    - by kirchhoff
    I implemented ParallaxScrolling for my SideScroller project, everything is working but the tiled map (the most important part!). I've been trying out everything but it doesn't work (see the code below). I'm using ParallaxCamera from GdxTests, it's working perfectly for the background layers. I can't explain myself properly in english, so I recorded 2 videos: Before parallaxScrolling After parallaxScrolling As you can see, now the platforms appear in the middle of the Y-axis. I've got a Map class with 2 tiled maps, so I need two renderers too: private TiledMapRenderer renderer1; private TiledMapRenderer renderer2; public void update(GameCamera camera) { renderer1.setView(camera.calculateParallaxMatrix(1f, 0f), camera.position.x - camera.viewportWidth / 2, **camera.position.y - camera.viewportHeight/2**, camera.viewportWidth, camera.viewportHeight); renderer2.setView(camera.calculateParallaxMatrix(1f, 0f), camera.position.x - camera.viewportWidth / 2, **camera.position.y - camera.viewportHeight/2**, camera.viewportWidth, camera.viewportHeight); } In bold, the code I think I should change. I've tried changing parameters, even adding hardcoded values, etc, but one of two: 1. Nothing happens. 2. Platforms disappear. Here is some aditional code. The render method: world.update(delta); parallaxBackground.update(camera); clear(0.5f, 0.7f, 1.0f, 1); batch.setProjectionMatrix(camera.calculateParallaxMatrix(0, 0)); batch.disableBlending(); batch.begin(); batch.draw(background, -(int)background.getRegionWidth()/2, -(int)background.getRegionHeight()/2); batch.end(); batch.enableBlending(); parallaxBackground.draw(batch, camera); renderer.render(batch);

    Read the article

  • Creating the “game space” for a 2D game

    - by alJaree
    How does one setup the game space for a game so that obstacles can be spawned? One example I am wondering about is doodle jump. Tile maps are limited in size and would need to change often if the user jumps a lot. How would this be done in another way than tile maps. How or what is used to create the notion of a game world where these spawned ledges/obstacles are placed as the user progresses through the stage? What is actually moving if the user jumps from ledge to ledge, what are the ledges based on in terms of the game world/space. What data structure or representation could the game use to reference and manage the spawning of these obstacles/ledges?

    Read the article

  • Making a Background Scrolling in Stacking Game

    - by David Dimalanta
    Hmmm...Is it a good idea to use a LibGDX parallax background for making a stacking game (i.e. PAPA STACKer Lite)? For example, I'm starting to use the blocks to drag-n-drop it. Next, when the next piece reaches the top of the screen, it automatically scrolls to the next one where the available space left. Aside from that, is it also involved with the camera code (Orthographic Camera) that the screen size appeared like 720x1280 but actually it's 1440x2560 for example? And another thing, does the background scrolling have the option to scroll from start to finish and infinite?

    Read the article

  • Scrolling background stops after awhile?

    - by Lewis
    Can anyone tell me where my maths is wrong please, it stops scrolling after awhile. if (background.position.y < background2.position.y) { background.position = ccp(background.contentSize.width / 2, background.position.y - 50 * delta); background2.position = ccp(background.contentSize.width / 2, background.position.y + background.contentSize.height); } else { background.position = ccp(background2.contentSize.width / 2, background2.position.y - 50 * delta); background.position = ccp(background2.contentSize.width / 2, background2.position.y + background.contentSize.height); } //reset if (background.position.y <-background.contentSize.height / 2) { background.position = ccp(background.contentSize.width / 2 ,background2.position.y + background2.contentSize.height); } else if (background2.position.y < -background2.contentSize.height / 2) { background2.position = ccp(background2.contentSize.width / 2, background.position.y + background.contentSize.height); }

    Read the article

  • Gap in parallaxing background loop

    - by CinetiK
    The bug here is that my background kind of offset a bit itself from where it should draw and so I have this line. I have some troubles understanding why I get this bug when I set a speed that is different then 1,2,4,8,16,... In main class I set the speed depending on the player speed bgSpeed = -(int)playerMoveSpeed.X / 10; and here's my background class class ParallaxingBackground { Texture2D texture; Vector2[] positions; public int Speed { get; set;} public void Initialize(ContentManager content, String texturePath, int screenWidth, int speed) { texture = content.Load<Texture2D>(texturePath); this.Speed = speed; positions = new Vector2[screenWidth / texture.Width + 2]; for (int i = 0; i < positions.Length; i++) { positions[i] = new Vector2(i * texture.Width, 0); } } public void Update() { for (int i = 0; i < positions.Length; i++) { positions[i].X += Speed; if (Speed <= 0) { if (positions[i].X <= -texture.Width) { positions[i].X = texture.Width * (positions.Length - 1); } } else { if (positions[i].X >= texture.Width*(positions.Length - 1)) { positions[i].X = -texture.Width; } } } } public void Draw(SpriteBatch spriteBatch) { for (int i = 0; i < positions.Length; i++) { spriteBatch.Draw(texture, positions[i], Color.White); } } }

    Read the article

  • How can I support scrolling when using batched rendering for my tiles?

    - by dardanel
    I have tiled map 100*75 and tiles are 32*32 pixel.I want to use batching for performance .I don't figure it out , because of my game needs scrolling and every frame i draw 22*16 tiles (my screen is 20*16 tile) .I thought that batching tiles for every frame .Is it good or any suggestion? edit :to more clarify I want to use occlusion culling and batching at the same time.I thought that drawing only visible areas and batching them together .But there is a something i couldn't figure out .When scrolling screen with translate matrix , if one row become invisible , I bind new row and batch them again.Every batched objects needs to buffer again.So I batch tiles and buffer to VBO every time when one row become invisible .I don't know these way is efficient or not .This is my question .And i am open to any suggestions.

    Read the article

1