+1 vote

Hi,
I want to make a mobile game where the player keeps moving to the right and finds goodies on the way.

I am able to move the player to the event.position through the InputEventScreenTouch event.
I tried to move the player to the right endlessly through the parallax layer mirroring property. However, in my method even the first mirror image of the Texture (sprite background) does not show up during run time.
I am able to move around the player in the original Texture (sprite background) only.

My Nodes are as below

KinematicBody2D
---Sprite (player)
---Camera2D
------ParallexBackground
-----------ParallexLayer
---------------Sprite background (which I am trying to mirror)

What am I doing wrong?
Is there a requirement to bring in the process function? Or just the input(event) function can do the work?
I am able to move around the player within the original Sprite by the input(event) function alone.

Is there any other way to do this: that is, move a sprite in the mobile game to the right endlessly with a swipe?

Please help.

in Engine by (100 points)

1 Answer

0 votes

In this type of the game, where the player is continuously moving right or left: it's not the player that is actually moving - it's the background that is moving instead, unless you want the player to move off the screen and disappear. The player is only animating to indicate the movement. In games like SMB the Mario char will only move within like 50% of the screen horizontally, and when it reaches the boundaries, the background is scrolling to left or right depending on which side it is. It can be done vertically in the same way.

by (21 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.