ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Help with CopperCube
forum topic indicator negative ammo
person icon
chrisz
Registered User
Quote
2023-09-19 17:46:01

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?

person icon
VP
Guest
Quote
2023-09-19 19:33:31

If variable "firing" >0, Shoot
[b]If variable[/]b "firing" <0, Set variable "firing" =0

person icon
VP
Guest
Quote
2023-09-19 19:33:55

If variable "firing" >0, Shoot
If variable "firing" <0, Set variable "firing" =0

person icon
chrisz
Registered User
Quote
2023-09-19 19:41:51

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?

person icon
chrisz
Registered User
Quote
2023-09-19 19:43:50

I think i must do this in the scene start?

person icon
chrisz
Registered User
Quote
2023-09-19 19:55:16

embedded external image
🔎︎


person icon
chrisz
Registered User
Quote
2023-09-19 22:20:51

Must be

if munition > 0 then shoot (thanks Xaron)

but how it to tell copper cube?

person icon
just_in_case
Moderator
Quote
2023-09-20 05:27:56

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".

person icon
veganpete
Registered User
Quote
2023-09-20 08:30:43

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.

person icon
chrisz
Registered User
Quote
2023-09-20 13:48:53

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.

person icon
serge
Registered User
Quote
2023-09-20 14:13:04

Here's something you can follow for bullets, bullets ending at 0, and reload ammo.

https://youtu.be/L2gXt-u3feg?si=...

person icon
chrisz
Registered User
Quote
2023-09-20 14:35:06

I made for me this graphical manual how i have it done.

Without it i bet i forget it until tomorrow emoji icon_grin

Maybe it is usefull for others.

embedded external image
🔎︎


person icon
chrisz
Registered User
Quote
2023-09-20 19:25:11

https://youtu.be/ElG8hMa3iw8

person icon
Dieter
Guest
Quote
2023-09-21 17:58:43

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.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |