Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Fuze shoot wip

    Work In Progress
    8
    38
    1897
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • waldron
      waldron F @DaddyJDM last edited by

      @DaddyJDM nothing is going off screen as the reticle is where you fire, iv tried a manner of things but i guess this is the best route before getting further into the build.
      hoping to have miss fires reduce round times.

      1 Reply Last reply Reply Quote 1
      • Jongjungbu
        Jongjungbu F last edited by

        Aren’t you already doing a collision check for when they make a hit, and destroying the target sprite? If they press fire and the result isn’t destroying the sprite that’s a miss.

        waldron 1 Reply Last reply Reply Quote 1
        • waldron
          waldron F @Jongjungbu last edited by waldron

          @Jongjungbu how would i track a non collision apart from the way im trying.
          i tried true/false switch but maybe i laid out the code wrong im not over invested in which way i do it so what ever seems best

          1 Reply Last reply Reply Quote 0
          • B
            Bl4ckM4ch1n3 last edited by

            So how are you tracking a hit? Do you check if the crosshair collides with the target sprite or are you actually "firing" a bullet sprite?

            waldron 1 Reply Last reply Reply Quote 1
            • waldron
              waldron F @Bl4ckM4ch1n3 last edited by waldron

              @Bl4ckM4ch1n3 the collision occurs when sprites detect each other and c.zr all in a "for loop"
              then outside of that i just have the if c.zr statement setup for non collisions, no bullet sprite

              1 Reply Last reply Reply Quote 0
              • B
                Bl4ckM4ch1n3 last edited by

                So you are using the detectSpriteCollision() function?
                You could wait for c.zr and then check for a collision between the crosshair and the target. If the result is negative, thats a miss.

                waldron B 2 Replies Last reply Reply Quote 1
                • waldron
                  waldron F @Bl4ckM4ch1n3 last edited by waldron

                  @Bl4ckM4ch1n3 yeah im using the detectSpriteCollision() function, just not 100% sure how i can code that.
                  Currently iv bodged 2 offscreen sprites so when i press zr iv setspritespeed to then collide with the other which triggers the miss, if target hit iv done setspritelocation and speed 0 seems to work but bit to messy to track through out the build

                  1 Reply Last reply Reply Quote 0
                  • R
                    Richard F last edited by

                    I think you need to change the order a bit. First check for c.zr. If that's pressed check for the spirit collision. If they collide you've got a hit if not you've got a miss. And you don't check for the collision at all if the player isn't firing.

                    1 Reply Last reply Reply Quote 1
                    • B
                      Bl4ckM4ch1n3 @Bl4ckM4ch1n3 last edited by Bl4ckM4ch1n3

                      @waldron then try the method I've provided in my last post:

                      @Bl4ckM4ch1n3 said in Fuze shoot wip:

                      You could wait for c.zr and then check for a collision between the crosshair and the target. If the result is negative, thats a miss.

                      It's basically the same method as the one that @Richard has mentioned.

                      The following is not 100% accurate, since I haven't used F4NS in a while. But it should work this way:

                      if c.zr then
                          for i = 0 to len(targetArray) loop 
                              result = detectSpriteCollision(crosshair, targetX)
                              if result == true then
                                  thats a hit!
                              else
                                  thats a miss!
                          repeat
                      
                      R waldron 2 Replies Last reply Reply Quote 1
                      • R
                        Richard F @Bl4ckM4ch1n3 last edited by

                        @Bl4ckM4ch1n3 I re-read you post after I'd posted mine and thought I could have just said I agree with you.

                        1 Reply Last reply Reply Quote 0
                        • waldron
                          waldron F @Bl4ckM4ch1n3 last edited by waldron

                          @Bl4ckM4ch1n3 cheers il have to have another go at it later the button press and collision seem instantaneous il swap round some bits see if i can get a collision order sorted, as a fail safe i could just have a sprite over the screen with roundtime -= 5 and if target hit roundtime += 5 to cancel the miss fire.
                          seems like such a simple thing to do until you start trying to code it, for me anyway :)

                          1 Reply Last reply Reply Quote 0
                          • waldron
                            waldron F last edited by

                            i could just do away with misfires altogether but would be nice to track players accuracy either way il get it sorted and thankyou for your time

                            1 Reply Last reply Reply Quote 0
                            • B
                              Bl4ckM4ch1n3 last edited by

                              @waldron look at my last post again, I've provided some example-code. You can track the accuracy that way too!
                              Just increase a counter for every shot fired and a second counter for every hit. Then you'll be able to calculate the shot/hit-ratio.
                              You could even calculate the distance between the center of the crosshair and the center of the target-sprite to give different points:
                              Like +5 if you hit the center of the target and +1 if you hit it near the border.

                              waldron 1 Reply Last reply Reply Quote 2
                              • waldron
                                waldron F @Bl4ckM4ch1n3 last edited by

                                @Bl4ckM4ch1n3 excellent thank you i'l try this,yeah plan on using counters also for score. i like the idea of the extra score on accuracy i could put in the detect code if crosshair.x <= 5 ....
                                il give it a blast later cheers

                                1 Reply Last reply Reply Quote 1
                                • waldron
                                  waldron F last edited by

                                  Still not working unfortunately tried all sorts

                                  1 Reply Last reply Reply Quote 0
                                  • D
                                    DaddyJDM last edited by

                                    Start with @Bl4ckM4ch1n3 's code, but define a variable before the loop, say countHits.
                                    Then, inside your loop through the targets, add 1 to countHits if the shot hits the target.

                                    After the loop, check countHits - if it is zero, you know you have missed all targets.

                                    Is that helpful to try?

                                    waldron 1 Reply Last reply Reply Quote 0
                                    • waldron
                                      waldron F @DaddyJDM last edited by

                                      @DaddyJDM solved now I shared the program and jongjungbu fixed it, just one of those days

                                      1 Reply Last reply Reply Quote 4
                                      • waldron
                                        waldron F last edited by

                                        some updates added in more targets, pterodactyl takes 5 hits to take down
                                        exploding ducks.
                                        since the video iv added in Title text which has a random colour on each play as well as the cross hair.

                                        1 Reply Last reply Reply Quote 5
                                        • waldron
                                          waldron F last edited by

                                          Still not got to the pinnacle of this game yet, just hope I can pull it off ..lots more to come

                                          1 Reply Last reply Reply Quote 8
                                          • PickleCatStars
                                            PickleCatStars F last edited by

                                            Coming along nicely :)

                                            1 Reply Last reply Reply Quote 1
                                            • First post
                                              Last post