Help with Mobile Gameplay Level Generation Intro



Hey guys, my camera is off whilst working in this lesson. It’s not following my camera from the start of the platform where my character is placed, but its starting as per where the picture shows. I have included the game and game camera scripts well in case something else I did is off,

Hi Nova,

Your code looks correct so the only thing i can think of is that the viewport settings are incorrect.
Can you check that the project settings->display->window has the viewport width at 540 and height at 960. as per 04:08 in the Camera Limits lecture.

This is the only thing i can think of given the current information that might throw this off as we instantiate the camera.

Thanks in advance

Hi Marc,

Thanks for your reply. I did change the width as it was actually 1080 as I must have not changed it back to the smaller resolution which is fine now, but the camera is not starting at the bottom of the level for some reason? I thought the camera script was meant to follow the sprite as it jumps up and down? I’ll attach a photo of how it appears when I press play, as well as the current camera script. I am sure its something simple I am missing



.

Hi Nova,

From those screenshots everything seems to be correct which is a little bit odd.
If you can play the game, Go to the remote tab and select the GameCamera there and take a screenshot of that we might be able to see whats going on at that point.
It seems like for some reason the camera is not getting reference to the player and i just want to check if that is the case or if we need to look deeper into the issue.

Thanks in advance

Hi Marc,

I think I’ve captured the right screen but if not let me know, I’ll attach it below:

Hi Nova,

I also can’t see anything obvious there, I think the easiest thing to do at this point is to have you go to the project folder in windows and make it a zip file and upload it at the below link so i cant take a look directly to see if i can figure out what is going on there.

http://gdev.tv/projectupload

1 Like

Hi Marc,

No problems, thanks for offering to have a look at it, it must be a gremlin at this point that isn’t obvious. I’ve just uploaded the zip file now via the portal for when you have a spare minute, thanks for that.

This one took me far too long to spot so i apologize for that but it is a lesson in reading the logs :slight_smile:
In your error logs you have The local variable limit_distance is never used and i completely overlooked this dismissing it in the other log messages.

Here is your code

		var limit_distance = 420
		if limit_bottom > player.global_position.y:
			limit_bottom = player.global_position.y

The issue is that you havent added the limit distance to the code you have only declared that variable so the code should look like this


		var limit_distance = 420
		if limit_bottom > player.global_position.y + limit_distance:
			limit_bottom = player.global_position.y + limit_distance

Let me know if you run into any further issues and apologies that it took me so long to spot it!

1 Like

Thanks a lot Marc that fixed it, I shall continue with the course now :grinning: it’s all good I’ve just been working on the 3D course in the mean time, still learning plenty :slightly_smiling_face:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms