Ambiera ForumDiscussions, Help and Support. |
|
|
|||||
|
I didn't find a solution but maybe it is very easy. I start with 25 bullets. And the variable don't stop "firing" after the last bullet. it goes negative -1~ It should stop the action. Did you have a solution for this? |
||||
|
If variable "firing" >0, Shoot [b]If variable[/]b "firing" <0, Set variable "firing" =0 |
||||
|
If variable "firing" >0, Shoot If variable "firing" <0, Set variable "firing" =0 |
||||
|
Thanks VP I'm a rookie user. How could i add these code into the editor. Shoot is definied. The variable "firing" i must set? Into the player behavior? |
||||
|
I think i must do this in the scene start? |
||||
|
|
||||
|
Must be if munition > 0 then shoot (thanks Xaron) but how it to tell copper cube? |
||||
|
you can simply set variable on click as VP said, attach a behavior when a key is pressed do something , select "mouse key" as your key, then attach, if a variable has a value then do something, type "bullets" in variable name put "0" in the value and in operator put ">" and then in the action attach the "shoot" action, also attach another action to set a variable, and now simply type the "bullet" in variable name, and change the operator to "-" and in value put "1" . also make sure to initialize, bullets value in the before starting scene with a value by setting the "bullet" variable to something more than "0". |
||||
|
If you're still stuck/confused, I made a quick ccb file for you here as an example.... https://veganpete.itch.io/free-c... Click the"Shoot and Reload" example near the bottom of the download page. |
||||
|
Thanks a lot. The failure was i think my total knowless of programming. I put the shoot variable direct into the player behavior so i could not connect the ammo with the shoot. Maybe there is way. But i start now with the the ammo variable and put the shoot behavior into the ammo action. I didn't find such things in the documentation. Thanks all for help and sorry for my lack of knowledge in those things. Thanks veganpete. I will take a look on your work. Oh thats a lot of files on your link. |
||||
|
Here's something you can follow for bullets, bullets ending at 0, and reload ammo. https://youtu.be/L2gXt-u3feg?si=... |
||||
|
I made for me this graphical manual how i have it done. Without it i bet i forget it until tomorrow Maybe it is usefull for others. |
||||
|
https://youtu.be/ElG8hMa3iw8 |
||||
|
If you shoot and decrement the ammo variable only if ammo is greater than 0, it will never go below zero, and you can remove those upper right two steps. I guess you are already working on proximation ammo pickups, which is as much fun as it is easy. Just alter the ammo variable (add 25), and hide or remove the ammo-clip mesh the player picked up. |
|