Bullet object spawning - spawns further and further depending on my X position?

0 favourites
  • 11 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Apologies for the long title. I saw one other thread on this problem, but cannot find the solution. I have a 2D platformer, and I want the bullet (seed_bullet) to:

    fire from my player sprite (image point 1) when I collect the item, and press [spacebar] to "fire the bullet" (spawn object on player).

    When I am on the left side of the screen (my stage layout) the bullet spawns, and travels accordingly, however, as soon as I travel to the right, the bullet spawns and fires, but it spawns further away from my player. When I reach the far right side of stage, the seed is not even spawning in my layout. I have attached pictures of my event sheet for the bullet, as well as my layout, in case I am overlooking something, but I am stuck.

    The context:

    Player picks up seed, and gets his ammunition, then he can fire the bullet. I want the bullet to spawn from his Image Point 1 (which I have set to the player sprite). I am not concerned with directional facing yet... I cannot get the bullet to spawn even correctly.

  • Вы создаете пулю на том же слое, что и игрок?

    Может стоит посмотреть, как это сделано в других играх.

    Если не получится, выложите файл c3p и мы вам поможем.

  • Yes, I am using the free version, and I had to place my HUD (hitpoints and ammo counter) on a parallax layer, which left me no choice but to place everything else on the same layer. I appreciate your offer to help.

    As I previously mentioned, when I collect the seed on the left side of the screen, the bullets fire normally, however, as I progress to the right side of the stage, the origin point of the bullet lengthens further and further along the (X axis) away from the player sprite. When you collect the first seed, fire it, and you will see it firing from the origin point. walk to the right (to the edge of the cliff) and fire some more, and you will notice the origin of the bullet has moved. I only have a single "Scroll-to" behavior set on the player sprite for the camera - no additional conditions.

    I have attached a link to the C3 file, and disabled the limited ammo count on the event sheet, that way you can simply collect the "seed" and fire it to see my problem.

    WASD - moves/jump

    SPACE - fire seed (after collecting one at beginning)

    https://we.tl/t-PYVug00lhI

  • The player sprite is on layer "Layer 0" with 100% parallax. The bullets are spawned on layer "bg" with 0% parallax.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • No, both the player sprite and seed_bullet are on Layer 0.

  • ...

    https://we.tl/t-PYVug00lhI

    You gave a false link, I didn't find the file there.

  • The player sprite is on layer "Layer 0" with 100% parallax. The bullets are spawned on layer "bg" with 0% parallax.

    Oh, wait, you meant that the bullets should be on a parallax layer?

    I placed the bullets on my HUD layer (bg), and set the parallax to 100% x 0% and that fixed the problem.

    So, firstly, THANK YOU!

    Secondly, why did this happen? Every tutorial (both on YT and even the Construct 3 tutorials) use the same procedure:

    "add sprite, set condition to spawn sprite from player, add bullet behavior", and the bullets work; so with my immediate problem solved, I am curious why the bullets behave this way? The tutorials did not require me to set a new layer for the bullets, and now I don't have a HUD layer for my player.

  • > ...

    >

    > https://we.tl/t-PYVug00lhI

    You gave a false link, I didn't find the file there.

    odd, it works for me. Apologies. Let me see if I can do something else.

  • The tutorials did not require me to set a new layer for the bullets, and now I don't have a HUD layer for my player.

    You always need to specify a layer (name or number) when you create/spawn an object. You must have left the default value, which is layer number 0.

    I suggest using layer names instead of numbers. This way if you insert new layers later, you won't have to change your code.

  • > > ...

    > >

    > > https://we.tl/t-PYVug00lhI

    >

    > You gave a false link, I didn't find the file there.

    odd, it works for me. Apologies. Let me see if I can do something else.

    I looked again, and it turns out there was a little window that allowed you to download the file.

    You were told correctly above.

    You need to create a bullet on a layer on which there is no paralax.

    Here is an example on the screen.

  • Thank you!

    I was able to create a small workaround, however I guess I need to upgrade my license.

    Thank you again for your time and help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)