Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Timer timer = new Timer (1000, new ActionListener ()
- {
- public void actionPerformed(ActionEvent e)
- {
- if(secondsCriticZone == 6){
- Random r = new Random();
- int n = r.nextInt(101);
- if(!iniciat){
- if(n > 40){
- dibuixarRoig = false;
- }else{
- dibuixarRoig = true;
- secondsCriticZone = secondsCriticZone - 1;
- }
- }else{
- if(n > 20){
- dibuixarRoig = false;
- }else{
- dibuixarRoig = true;
- secondsCriticZone = secondsCriticZone - 1;
- }
- }
- }else{
- if(dibuixarRoig){
- if(secondsCriticZone != 0){
- secondsCriticZone = secondsCriticZone - 1;
- }else{
- secondsCriticZone = 6;
- dibuixarRoig = false;
- iniciat = true;
- System.out.println("Es 0 hauria de cambiar de smeafor a verd");
- }
- }
- }
- }
- });
- timer.start();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement