I am struggling with the first chapter of Godot Engine Game Development Projects by Pakt. In it, I am creating a function to instance and randomize coin locations . I am using 3.5.2.


When I run the game, the coins just generate at the origin and do not interact with the player.

I've included the script for Main and the screenshots of the editor that I have redone over and over. It still does not work. If I remove the spawn_coins function. The coins do not appear in the scene when it is played. When the func is there, the coin seems to be instantiated at (0,0) but does not interact with the other objects in the scene.

  • xyz replied to this.
  • pogi-dev
    In line 40 instead of:

    c.screensize = Vector2(...

    try:

    c.position = Vector2(...

    pogi-dev
    In line 40 instead of:

    c.screensize = Vector2(...

    try:

    c.position = Vector2(...

      xyz Thanks for that. That's how the books shows it, too. I can't believe I missed that. Thank you so much! You are my hero.
      However, they still don't go away when the player object touches it.

      Can you point me in the right direction for that?

      To help you further, we'd need to see other code too, as well as your scene hierarchy and signal connections.
      But I'd suggest following what's in the book as closely as possible. It's unlikely they made any mistakes or errors in the book.

        xyz Absolutely. I can't tell you how many times I've read and re-read. Always finding something new to tweak. Thanks again.

        xyz But I'd suggest following what's in the book as closely as possible. It's unlikely they made any mistakes or errors in the book.

        Well, it's not unusual for technical books to have errors in them but such books usually also have accompanying errata, that is a list of errors and corrections. So it might be worth searching online for "book name" + errata to find such a list of errors and corrections.

        With that said though, I agree it's better to stick close to what the book instructs the follower to do.

        I know this advice is hard to follow, but when you're just starting out avoid tutorials that require you to write lengthy amounts of code before you can test to see if that code is working properly. Else you will need to learn enough earlier on to find ways to test chunks of code using tools such as print, print_debug, and creating breakpoints.

        xyz It's unlikely they made any mistakes or errors in the book.

        I remember another PackT book on XNA and shaders maybe, first chapter is ok, the second also, then mistakes pops-up like crazy, many errors in texts, descriptions, code samples, quite like cheap book without any rereading and checks, made by some author who most likely to show of like "yyeeeeaaahh I wrtoe a book guys, I'm awesome" 😐. I hope PackT improve themselves since.

        Even the good old O'Reilly books start to became filled with mistakes these past years.

        5 days later

        I recently started the Coin Dash project, I just can't get the damn thing to work.