Trabalho_IA_4.2

Trabalho_IA_4.2 preview image

1 collaborator

Default-person Erique Souza (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 125 times • Downloaded 12 times • Run 0 times
Download the 'Trabalho_IA_4.2' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [ Jogador ]
breed [ capim ]
breed [ obstacles ]
breed [ Inimigo ]
breed [ Bandeira ]
breed [caixa]
breed [extra]
breed [boss]
globals [ name level score nextLevel lives aux aux3  ]

to setup
  ;; (for this model to work with NetLogo's new plotting features,
  ;; __clear-all-and-reset-ticks should be replaced with clear-all at
  ;; the beginning of your setup procedure and reset-ticks at the end
  ;; of the procedure.)
  __clear-all-and-reset-ticks
  
  set level 1
  set nextLevel 10
  set score 0
  set lives 3  
  set aux 11
  set aux3 1
  
  
  
  ask patches [ set pcolor green ]
  ask patches with [ pxcor > -8 and pxcor < 8 and pycor > 13 ] [ set pcolor cyan ]
  
  ask patches with [ pxcor > -8 and pxcor < 8 and pycor < -12 ] [ set pcolor brown ]
  
  create-capim 1 [ set shape "leaf"
                 set size 2
                 set color blue
                 setxy 0 max-pycor - 2
               ]
  create-Jogador 1 [ set shape "cow"
                 set size 3
                 set color orange
                 setxy 0 min-pycor + 2
               ]
  create-Inimigo 1 [ set shape "bug"
                 setxy 0 max-pycor - 6 
                 set size 3
                 set color brown
                 set heading 90
               ]
   
  
  
  create-Bandeira 1 [ set shape "flag"
                 setxy 2 max-pycor - 28
                 set size 2
                 set color yellow
                 set heading 90
               ]
  
  create-Bandeira 2 [ set shape "flag"
                 setxy 3.5 max-pycor - 28
                 set size 2
                 set color yellow
                 set heading 90
               ]
  
  create-Bandeira 3 [ set shape "flag"
                 setxy 5 max-pycor - 28
                 set size 2
                 set color yellow
                 set heading 90
               ]
  
  create-Bandeira 4 [ set shape "flag"
                 setxy 6.5 max-pycor - 28
                 set size 2
                 set color yellow
                 set heading 90
               ]
  create-Bandeira 5 [ set shape "flag"
                 setxy 8 max-pycor - 28
                 set size 2
                 set color yellow
                 set heading 90
               ]
  
  create-Bandeira 6 [ set shape "flag"
                 setxy -1 max-pycor - 28
                 set size 2
                 set color yellow
                 set heading 90
               ]
  
  create-Bandeira 7 [ set shape "flag"
                 setxy -2.5 max-pycor - 28
                 set size 2
                 set color yellow
                 set heading 90
               ]
  
  create-Bandeira 8 [ set shape "flag"
                 setxy -4 max-pycor - 28
                 set size 2
                 set color yellow
                 set heading 90
               ]
  create-Bandeira 9 [ set shape "flag"
                 setxy -5.5 max-pycor - 28
                 set size 2
                 set color yellow
                 set heading 90
               ]
  
  create-Bandeira 10 [ set shape "flag"
                 setxy -7 max-pycor - 28
                 set size 2
                 set color yellow
                 set heading 90
               ]
  
  create-caixa 1 [ set shape "box"
                 setxy 2 max-pycor - 15
                 set size 3
                 set color yellow
                 set heading 90
               ]
   create-caixa 2 [ set shape "box"
                 setxy 4 max-pycor - 15
                 set size 3
                 set color yellow
                 set heading 90
               ]
   
   create-caixa 3 [ set shape "box"
                 setxy 0 max-pycor - 15
                 set size 3
                 set color yellow
                 set heading 90
   ]
end 

to moveJogador
  fd (0.2 - (level * 0.01))
  ask Jogador with [ any? obstacles-here ] [ set score score - 10
                                          set lives lives - 1
                                          die ]
  ask Jogador [ bounce ]
end 

to novasformigas
  
 create-Inimigo 1 [ set shape "bug"
                 setxy 0 max-pycor - 6 
                 set size 1
                 set color random color
                 set heading 90
               ]
end   

to bigboss
  
  
  create-Inimigo 1 [ set shape "bug"
                 setxy 0 max-pycor - 7
                 set size 8
                 set color brown
                 set heading 90
               ]
end 

to bounce  
  if (abs [pxcor] of patch-ahead 1 = max-pxcor)
    [ set heading (- heading) ]

  if (abs [pycor] of patch-ahead 1 = max-pycor)
    [ set heading (180 - heading) ]
end 

to advanceLevel
  if score >= nextLevel
  [
    set level level + 1
    user-message "Voce Subiu de level"
    ask Jogador [ setxy 0 min-pycor + 2 ]
    ask Inimigo [ setxy 0 max-pycor - 9   ]    
   
    ask obstacles [ die ]
    set nextLevel nextLevel + 10
     ]
end 

to InimigoSetup
  if [pxcor] of patch-ahead 1 = -9 [ set heading (- heading) ] 
  if [pxcor] of patch-ahead 1 = 9 [ facexy -19 11 ] 
  fd 0.3
  
  if level > 1 [ ask Inimigo[intelig] ]
end 

to bossSetup
  
  if [pxcor] of patch-ahead 1 = -9 [ set heading (- heading) ] 
  if [pxcor] of patch-ahead 1 = 9 [ facexy -17 11 ] 
  fd 0.1
  
  if level > 1 [ ask boss[intelig] ]
end 

to intelig
  
  if aux3 = 1 [set aux aux + 0]
  if any? Jogador in-radius aux   
    [ set heading (towards min-one-of  Jogador [ distance myself]) + random 0.0
      
      if [pxcor] of patch-ahead 1 = -9 [ set heading (- heading) ] 
  if [pxcor] of patch-ahead 1 = 9 [ facexy -19 11 ] 
 
           ] 
    
     
     if [pxcor] of patch-ahead 1 = -9 [ set heading (- heading) ] 
  if [pxcor] of patch-ahead 1 = 9 [ facexy -19 11 ]    
end 

to go
  if name = 0.0 [ set name user-input "Digite Seu Nome:"
                  user-message " Boa Sorte" ]
 
  
  every 0.1 - (level * 0.01) [ ask Inimigo [ InimigoSetup ] ]   
  ask Jogador with [ any? Inimigo-here ] [ set score score - 15
                                       set lives lives - 1
                                        ]
  
  ask Jogador with [ any? Inimigo-here ] [  setxy 0 min-pycor + 2   ]                                     
                                    
  if lives < 1 [ user-message "Voce perdeu não tem mais vidas" stop ]
  
  ask Inimigo with [ pcolor = brown ] [ set heading (- heading) ]
  ask Inimigo with [ pcolor = brown ] [ facexy -19 11 ]
  ask Inimigo with [ pcolor = cyan ] [ set heading (- heading) ]
  ask Inimigo with [ pcolor = cyan ] [ facexy -19 11 ]
  
   ask Inimigo with [ any? Bandeira-here ] [ set heading (- heading) ]
  ask Inimigo with [ any? Bandeira-here ] [ facexy -19 11 ]
  
  ask Inimigo with [ any? caixa-here ] [ set heading (- heading) ]
  ask Inimigo with [ any? caixa-here ] [ facexy -19 11 ]
  
  ask Jogador with [ pcolor = cyan ] [ set score score + 10    ]
  ask Jogador with [ pcolor = cyan ] [  setxy 0 min-pycor + 2   ] 
  
  
  
  advanceLevel
end 

There is only one version of this model, created about 11 years ago by Erique Souza.

Attached files

File Type Description Last updated
Trabalho_IA_4.2.png preview Preview for 'Trabalho_IA_4.2' about 11 years ago, by Erique Souza Download

This model does not have any ancestors.

This model does not have any descendants.