Exemple #1
0
    def __init__(self, image, x, y, radius, health, max_speed, render_group = foreground, collision_group = collision_objects): 
        super(Unit, self).__init__(image, x, y, radius, render_group, collision_group)        
        #stats
        self.health = Stat(health, health)
        #movement stuff
        self.sprinting = False
        self.crouching = False
        self.friction = 0.001
        self.max_speed = max_speed
        self.up = False
        self.left = False
        self.down = False
        self.right = False
        self.aim_x = 500
        self.aim_y = 500
        self.target = None
        #gun stuff
        self.accuracy_modifier = 1
        self.recoil = .0
        self.cooldown = 0
        
        self.guns = [Gun(carbine_gun_type, self, carbine_gun_type.mag_size*3),
                     Gun(shotgun_gun_type, self, shotgun_gun_type.mag_size*3),
                     Gun(sniper_gun_type, self, sniper_gun_type.mag_size*3),
                     Gun(pdw_gun_type, self, pdw_gun_type.mag_size*3),
                     Gun(lmg_gun_type, self, lmg_gun_type.mag_size*3),
                     Gun(saiga_gun_type, self, saiga_gun_type.mag_size*3),
                     Gun(rpg_gun_type, self, rpg_gun_type.mag_size*3)]
        
        self.gun = choice(self.guns)

        self.health_bar = Bar(stat = self.health, x = x, y = y-(self.height/2))

        #random name label
        self.name = generate()
        self.label_offset = -50
        self.label = pyglet.text.Label(self.name, x=self.x, y=self.y+self.label_offset, batch=batch, group = hud, anchor_x="center")

        #walksound test
        self.walkcycle = 0

        self.collision_group.append(self)
        self.check_collision()
        self.push(0, 50)
Exemple #2
0
 def test_containSpaceF(self):
     self.assertFalse(namegen.generate("Ho jun", "Shin"))
Exemple #3
0
 def test_rightCase(self):
     self.assertEqual(namegen.generate("Hojun", "Shin"), "Hojun Shin")
Exemple #4
0
 def test_containSpecBoth(self):
     self.assertFalse(namegen.generate("3o#@$", "Sh0$"))
Exemple #5
0
 def test_containSpecL(self):
     self.assertFalse(namegen.generate("Hojun", "$4in"))
Exemple #6
0
 def test_containSpecF(self):
     self.assertFalse(namegen.generate("#8$un", "Shin"))
def generate_label():
    name = namegen.generate(FIRST_NAME_SET, LAST_NAME_SET)
    return "\"" + name + "\""
def gen_name():
	return namegen.generate()