This site requires JavaScript, please enable it in your browser!
Greenfoot back
new113
new113 wrote ...

2017/1/17

Health Bar

new113 new113

2017/1/17

#
I want to create a health bar and I don't know how and it does not have to appear on screen.
danpost danpost

2017/1/18

#
new113 wrote...
I want to create a health bar and I don't know how and it does not have to appear on screen.
If it does not have to be on the screen, then you do not need the graphic representation of the value -- just the value. A simple int field should suffice. My Value Display Tutorial may be able to help even without the displaying of the value.
new113 new113

2017/1/18

#
Thank you. Also I wanted to know how to make object spawn when a button is pressed.
danpost danpost

2017/1/18

#
new113 wrote...
Thank you. Also I wanted to know how to make object spawn when a button is pressed.
Use an 'if' statement. Put the condition inside for the argument of the 'if'. Add the object into the world from within the block of the 'if'. Not enough information to help any further (no code; 'button' is ambiguous; too general).
new113 new113

2017/1/19

#
The code I have tried is this if (Greenfoot.isKeyDown("space")) { addObject(bullet, 300, 200); } then it says "cannot find symbol - variable.
danpost danpost

2017/1/19

#
new113 wrote...
The code I have tried is this < Code Omitted > then it says "cannot find symbol - variable.
I presume 'bullet' is highlighted. Do you declare the 'bullet' variable anywhere? If so, where? How? Does it currently reference an Actor object? Show more code.
You need to login to post a reply.