Runner Tutorial: No Spawning Platforms

With the Runner Tutorial I see no spawning platforms after adding them to the game.

runner-2018-03-07-001.zip (1.4 MB)

1 Like

There is another problem: the frog drops from the main platform. There is like a little gap or something.

1 Like

I just tried your example, and I suggest you enable the physics.debug option in the game.project file.
This let’s you see that the ground collision object is offset.
The offset platform will cause you to “fall off the cliff” earlier than expected

Next, the platforms work fine, it’s just that the current speed is so low, that it will take a very long time for the platforms to appear. Reset the speed to default (360) and the platforms will show up soon enough

3 Likes

This tutorial has not taught me to debug in Defold. What should I debug and how do I do that?

I corrected the game a little bit.
runner-2018-03-07-002.zip (1.4 MB)

It depends on the problem you have:

  • Unsure about the flow of your code or the state of your variables = Set a breakpoint (double click next to a line number) and run your code using Debugger->Run with Debugger
  • Performance issues (low frame rate or hitches in fps) = Use the web profiler
  • Problem with physics = Enable Physics Debug in game.project or set a breakpoint in on_message and look for collision_response and contact_point_response messages
1 Like

The Box Shape for ground.collection is correct, so there is nothing to fix:

Position [789] [-25] [0]
Width [1596]
Height [76]

Or is it correct? Should it be larger than the images altogether?

What are the correct measurements in the tutorial? Does the tutorial mention the correct size?

Well, that part I think is up to you. I mentioned this, since the character seems to start more to the right on the screen than I would have expected. And there’s a lot of empty space to the left of the character when you start. Is the whole level offset perhaps?

Here the character is about to be pushed off the platform:

Here the level itself seems offset from origin (coordinate 0,0):

1 Like

Yes, level.collection is offset from the main.collection:

Position it at 0,0 and you’re good to go.

For me the ground.collection and level.collection are correct when looking at it graphically.

Okay, I found the main.collection.

I don’t know how I missed the main.collection. There are quite many places to look at, it seems, to find your mistakes.

I think my thinking error is that I thought you are not supposed to look at main, because you are a newbie and you should only look at the level folder and hero folder at this point of the tutorial.

Nowhere in the tutorial are you told what the coordinates of the level.collection should be inside main.collection (or I can’t find that information). There is a possibility that someone (me) puts the level.collection in an incorrect position, because a newbie does not know the consequences of all his actions (like all the numeral values in every place), so the tutorial could contain more exact information where to put each object and component.

It could perhaps be written explicitly, but I found this in Step 2:

“Make sure you place ground.collection in position 0, 0, 0 or it will be offset visually”

And this in Step 5:

“Open main.collection and replace ground.collection with level.collection”

2 Likes

Well, as soon as things don’t go as expected, you will need to start digging around and try to figure out what’s wrong. That is what debugging is all about and it takes a long time to learn where and how to search for errors.

No, a new user may not know the consequences of all actions but there is a meaning to every single value and thing in Defold (as in pretty much all software). Do not be alarmed if changing a value somewhere breaks stuff, but at that moment, you should try to understand what went wrong and what the meaning of the value (or whatever) is. That is part of the normal learning process. You build something, you make errors, you tinker with it, try to debug and and learn what things are and how they work together. If you are new to programming this is a very long, but very fun and extremely rewarding, process.

I will make an explicit clarification in the tutorial about the position of level.collection.

7 Likes

The frog could be more to the right as in the original game. Do I change the position in hero / hero.go, so that I select Game Object, spinemodel and then the Properties panel? Or do I change the position of the hero somewhere else?

1 Like

I’d suggest moving the hero game object in the level.collection.

The placement of components within the game object, is usually somewhere close to the gameobject’s origin (position (0,0,0)). This makes it easier later on, when you wish to spawn multiple instances of a game object. For instance, imagine a multiplayer runner with two heroes, then it makes more sense to move the placement of the heroes inside the level.collection.

3 Likes

The tutorial’s HTML version (the one on your website) does not work on my MacBook Pro (Early 2011, 15.4", 2.0 GHz Intel i7, 4 GB memory) with Google Chrome 65. Is the video card the reason? This MacBook Pro has two video cards: (1) AMD Radeon HD 6490M, 256 MB, GDDR5, OpenGL 4.1, OpenCL 1.2 and (2) Intel HD Graphics 3000, 384 MB DDR3 SDRAM.

What does Chrome say is the problem? Open the console and check for errors.

1 Like