Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
Can anyone know how to make these in CC?

eminem100
Guest
Quote
2017-03-30 18:57:08

Please try to make a player health counter.
Also the bullet counter, after which the player'll not be able to shoot


monoray
Registered User
Quote
2017-03-30 23:35:08

Alright I think I can help.

For the shoot;

when (shoot key) pressed down,
if variable (ammo) is more then 0
change variable shoot=1 else change variable shoot=0

when (shoot key) left up
change variable shoot =0

every few seconds (time depending on the fire rate of the weapon)
if variable shoot = 1
(do your shoot commands, however you want to script those)
set/change variable (ammo) -1

then whenever you pick up an ammo box:
set/change variable (ammo) + (amount of bullets)


monoray
Registered User
Quote
2017-03-30 23:46:04

That the code for a machine gun or any weapon that you want to continue firing as you hold down the mouse btw.

For health, the script really matters on what kind of enemies you have and how you handled variables for them, but here's a system that would harm you continuously over time while in the proximity of another scene node. ;

before first drawing; set variable health to 50

every few seconds
if variable health is less then 1
(death behaviors, you decide)

on proximity to scene node entering proximity (bad guy, bullet, any scene node you want to do damage to you when your close to it)
change variable damage to 1

on leaving proximity to scene node (bad guy)
change variable (damage) to 0

every few seconds (anywhere from 1/2 a second to every 2 seconds, you decide.
if variable damage=1
change variable (health) -1


monoray
Registered User
Quote
2017-03-30 23:54:17

Also, if your looking for a health bar type of thing, line up 2d overlay blocks to make a health bar. then in a behavior scene node (don't put it in the blocks because they will be hidden)

every few seconds;
if variable (health) is less then 40
hide (block furthest right)
else;
make visible (block furthest right)

do this with all the blocks, with the "less then 40" going down by tens (or whatever turns out even with the amount of health and how many blocks you have).

This will make blocks hide themselves in order to display your approximate health. It's not perfect, but it works.

Hope some of this helps.


crackyourspeaker
Registered User
Quote
2017-03-31 02:48:21

Great stuff, this will definitely help me out for future projects, thanks for sharing


crackyourspeaker
Registered User
Quote
2017-04-24 09:53:41

can you make a video on the health bar?? im not sure how to do it


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internationa?" (you are not logged in)


Text:

 

  

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


   






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