Player won't shoot bullets.

0 favourites
  • 12 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • I followed the instructions of a video but it still won't work. What am I doing wrong, guys? I want my character to shoot until it runs out of bullets.

    Tagged:

  • What exactly doesn't work? Do you see the "Ammo: 6" text? If not, maybe you forgot to link your event sheet to the layout.

  • Hi Memph here are a couple of ways to achieve what I think you're going for.

    Use this 1 if you want to only shoot when you hit the key

    Use this 1 if you're looking for an automatic firing while you hold down the key. (adjust the every 0.5 seconds to change fire rate) Hope this helps.

  • The textbox shows the bullet count going down every press of the Spacebar but my character won't spawn bullets. Only the first bullet flies away from the character (if I place the bullet in the layout area then it won't spawn at all).

  • Hi Memph here is a link to the example I created to test this out for you. Hope this helps. drive.google.com/file/d/14iobXATfuAjhkKrVOzlmCc3yNqVkHFt2/view

    *EDIT* I actually see what might have happened to you. I had the bullet just outside the layout and it worked fine but when I removed that it did exactly what it is doing to you. Not sure why I didn't think of this but try making a new layout with no event sheet for objects and put your bullet in there adjust the size of the bullet to where you want it. The example link has been updated to show what i'm talking about.

  • I downloaded those files from that link but then I needed to download an app to open them (json genie) and then I still couldn't open them lol.

    I'll try moving the bullet off the layout but I think I already did try it yesterday.

    I just don't get it. I can make the character shoot infinite bullets but when I try to add limitations, it just won't work. Something to do with bullet properties maybe?

  • Oh yeah google does that preview thing. If you click the link and then click the download button on the top right it will download a .c3p file which you can open if you go into Contruct 3 hit open file and select it. I'm just now realizing you may be using Construct 2 if so let me know I have that also. We'll get this figured out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I use construct3 as a free user at the moment.

    I managed to upload your version which works fine. I then went to copy and past your event sheet to mine and it still wouldn't work.

    The only different thing I can see is have a separate sheet called object repository. How can I recreate that?

  • So basically all I did for that was on the right hand side at the top where it says layouts right click and add new layout. When it asks if you want to create an event sheet you don't have to but can if you want. This layout just acts as a place where things live without being in the way. I then just named it ObjectRepository and put a single bullet in there. If anything you could just open my example separate and see what is different in mine something is bound to stick out. Not sure if this is a factor but In mine the bullet spawns at a secondary image point on the player. If you have events set that destroy the bullet if it hits the player and you spawn the bullet at an image point in the center of the player sprite it'll instantly be destroyed. Worth checking out.

  • Only the first bullet flies away from the character

    Run the project in Debug Mode (Shift+F4). After firing a second bullet pause the preview and then find the bullet in the list of objects on the left. Check how many instances of the bullet are there, check their properties. Maybe the new bullet is invisible, or on a wrong layer, or has wrong coordinates etc.

    Debug Mode is a super useful tool for troubleshooting. If it doesn't help, consider posting your project file.

  • Thanks, guys, it now works! I created another image point and placed it just outside the player.

    Thank you so much for your help!

  • No problem glad it worked out. Best of luck with your game!

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