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

2017/4/23

I NEED IMMEDIATE HELP

1
2
3
4
5
6
Xmin_Terminator Xmin_Terminator

2017/4/24

#
Everywhere where there is the exact word laser (the word on its own with all lower cases) in the code, it comes up with an error saying cannot find symbol - variable laser
Super_Hippo Super_Hippo

2017/4/24

#
Did you comment out line 7?
Xmin_Terminator Xmin_Terminator

2017/4/24

#
no, was I meant to?
Xmin_Terminator Xmin_Terminator

2017/4/24

#
oops I forgot to type that line, just realised sorry, let me try
Super_Hippo Super_Hippo

2017/4/24

#
No, of course not. This line should create the 'laser' variable.
Xmin_Terminator Xmin_Terminator

2017/4/24

#
when I have all the code in, I get errors in my world sub-class where I am adding the buttons. This occur in the lines : LaserButton laserButton1 = new LaserButton(); and underlines the second LaserButton coming up with the error : constructor LaserButtton in class LaserButton cannot be applied to other given types; required: LaserWall found: no arguments reason: actual and formal argument lists differ in length This error occurs for all the 20 lines to add the buttons
danpost danpost

2017/4/24

#
Each time you create a LaserButton, you need to give it the laser that it is to work with. So, first create a laser and add it to the world; then create the button for that laser, supplying the button with that laser, and add it to the world. See how I created a LaserButton object in the previously shown code.
Xmin_Terminator Xmin_Terminator

2017/4/24

#
I do not understand is it possible I post my scenario and you show me
danpost danpost

2017/4/24

#
Every time you use 'new LaserButton(', you must include the laser that this button is to control between the parenthesis, ')'. So:
// first laser and its button
LaserWall laser = new LaserWall(); // create laser
addObject(laser, << wherever >>); // add laser to world
LaserButton button = new LaserButton(laser);  // create button for laser
addObject(button, << wherever >>); // add button to world

// second laser and its button
LaserWall laser2 = new LaserWall(); // create laser2
addObject(laser2, << wherever >>); // add laser2 to world
LaserButton button2 = new LaserButton(laser2); // create button2 for laser2
addObject(button2, << wherever >>); // add button2 to world

// third laser and its button
....
Xmin_Terminator Xmin_Terminator

2017/4/24

#
Ok I think I sort of understand, I will give it a try
Xmin_Terminator Xmin_Terminator

2017/4/24

#
Thanks a lot both of you for your time and full support, also wit quick response. I have achieved what I wanted and will continue to finish my game for my school test. If I have any problems I will message further. Thank you danpost and Super_Hippo
Xmin_Terminator Xmin_Terminator

2017/4/25

#
I do not know how to make a score counter that ticks upwards when the player collects coins whilst running through the maze, but the score counter looses a point every second. Could you please show me through how one of these is made and explain how it works and why it works.
Super_Hippo Super_Hippo

2017/4/25

#
You can import the Counter class. To the act method, you can add code to decrease a point every second. A second is about 50-60 act cycles, no need to use real seconds. You can either decrease the variable every act cycle and display /60 of the variable or you need a second int variable to count to 60 and decrease the actual score variable by 1 whenever it reaches 60. Then, whenever the player collects a coin, you have to call the 'add' method (using 'counter.add(1)')on this Counter object (→ save a reference to it in your world or in the player class itself).
Xmin_Terminator Xmin_Terminator

2017/4/25

#
How would I code a timer like that that ticks down ever seccond
Xmin_Terminator Xmin_Terminator

2017/4/26

#
I have done the adding part, put am very confused on how to do the taking away a score point every second or 60 cycles. I can't find any examples on the internet.
There are more replies on the next page.
1
2
3
4
5
6