__author__ = 'ariel'

import pygame
import Box2D
from Box2D.b2 import *
from colors import *
import images
from element import *
from random import randrange

def add_test( handler ):
    # And a static body to hold the ground shape
    handler.add_element( Element( handler.world.CreateStaticBody( position=(0,0),shapes=polygonShape(box=(50,1)),color=(0,0,0) ), handler , base ) )

    # Arco 1
    #handler.add_element( Element(handler.world.CreateStaticBody( position=(1.5,8),shapes=polygonShape(box=(1.5,0.1)),color=(0,0,0) ) , handler , goal) )
    #handler.add_element( Element(handler.world.CreateStaticBody( position=(0,0),shapes=polygonShape(box=(0.2,30)),color=(0,0,0) ) , handler , goal) )

    # Arco 2
    #handler.add_element( Element(handler.world.CreateStaticBody( position=(43.5,8),shapes=polygonShape(box=(1.5,0.1)),color=(0,0,0) ) , handler , goal) )
    #handler.add_element( Element(handler.world.CreateStaticBody( position=(44.8,0),shapes=polygonShape(box=(0.2,30)),color=(0,0,0) ) , handler , goal) )

    #techo
    handler.add_element( Element(handler.world.CreateStaticBody(position=(0,29.9) ,shapes=polygonShape(box=(50,0.1)),color=(0,0,0) ), handler ,goal) )
    #borde 1
    #handler.add_element( Element(handler.world.CreateStaticBody))
    #arco_tr_1.color = goal
    # arco_fn_1.color = goal
    # Arco 2

    # Create a couple dynamic bodies


    e=handler.add_element(Element(handler.world.CreateDynamicBody(position=(38,2) , linearVelocity=(-randrange(1000),randrange(240)) , bullet=True ), handler  , ball))
    #e.linearVelocity=(90,16.445)

    circle=e.body.CreateCircleFixture(radius=0.475, density=200, friction=0.1 ,restitution=0.95)
    handler.ball = circle

    #body.ApplyForce(force=(10,10), point=(3.1,15) , wake = False)
    #body.ApplyTorque(1.0 , wake = False)


    #circle.color = ball

    #body=handler.world.CreateDynamicBody(position=(10,25), angle=15)
    #box=body.CreatePolygonFixture(box=(2,1), density=1, friction=3,restitution=0.1)

    handler.add_element(Head((1,1),images.HeadsImages.headA , handler , J1))
    handler.add_element(Head((30,1),images.HeadsImages.headB , handler , J2))
    goals = Goals(0,handler)
    handler.add_element(goals)
    handler.goal = goals
