Beispiel #1
0
def degage_cote(a):
    dep=a.ball_position-a.my_position            #--> bloquer le passage de la balle 
    dep.x=0
    
    if a.can_shoot() == 0:  # Shoot ou pas        
        if a.my_position.y >= settings.GAME_HEIGHT/2: 
            res= SoccerAction(dep,Vector2D((3.14),4.5)) # angle a modifie
            res.name="degage_cote_haut"
            return res
        else:
            res=SoccerAction(dep,Vector2D(-(3.14),4.5))
            res.name="degage_cote_bas"
            return res
    return SoccerAction(dep,Vector2D())
Beispiel #2
0
def dribleStrat(etat):
    V = (etat.ball_position - etat.adv_but)*1.05
    if not(etat.dans_zone(zone(etat.adv_but + V - Vector2D(5,5), etat.adv_but + V + Vector2D(5,5)),etat.my_position)):
        res =  SoccerAction((etat.adv_but + V) - etat.my_position, Vector2D(0,0))
    else:
        res = SoccerAction(etat.ball_position - etat.my_position,0.030*(etat.adv_but - etat.my_position))
    res.name = "dribleStrat"
    return res
Beispiel #3
0
def tire_basStrat(etat):
    V = Vector2D(angle = -45, norm = 2)
    if not((etat.ball_position - etat.my_position).angle < -42 and (etat.ball_position - etat.my_position).angle > -48):
        res =  etat.go(etat.ball_position - 0.1 *V)
    else:
        res =  SoccerAction(etat.ball_position - etat.my_position,Vector2D(angle=-45, norm=2))
    res.name = "tire_basStrat"
    return res
Beispiel #4
0
def passe(me):
	res=SoccerAction(Vector2D(),Vector2D())
	res.name="passe"
	if me.test_peut_shooter:
		res=me.shoot_vers_norm(me.pos_equi_pr_ball,3.0)
		return res
	else:
		res=me.courir_vers_ball2
		return res
Beispiel #5
0
def degager(app):       
    hisg = Vector2D((2-app.key[0])*settings.GAME_WIDTH,settings.GAME_HEIGHT/2.)
    shoot=hisg-app.ball_position
    
    s=SoccerAction(app.ball_position-app.my_position, shoot)
    s.shoot.norm=4
    
    if app.key[0]==2: #miroir fail 
        s.acceleration.x=-s.acceleration.x
        s.shoot.x=-s.shoot.x
        
    if app.can_shoot() == 0:
        s.name="degager"
        return s

    return SoccerAction(Vector2D(),Vector2D())
Beispiel #6
0
def attend(etat):
    res = SoccerAction(Vector2D(0,0),Vector2D(0,0))
    res.name = "attend"
    return res