Esempio n. 1
0
def test_coin3():
	'''collect coin while jumping'''

	Scene.make_cm(80)
	PERSON.xpos = 25
	PERSON.ypos = 151
	Scene.brick_coin()
	# print(Manage.score)
	s1 = Manage.score
	Person.moveup(PERSON)
	Scene.brick_coin()
	# print(Manage.score)
	s2 = Manage.score
	assert s2 > s1
Esempio n. 2
0
def test_score_brick():
    '''collecting coin when collision with brick'''
    # Board.board_initialise(BOARD,0)
    Scene.make_cm(0)
    PERSON.xpos = 25
    PERSON.ypos = 3
    PERSON.jump = 8
    for i in range(41):
        Person.moveright(PERSON)

    print(PERSON.xpos, PERSON.ypos)
    Scene.brick_coin()
    initial_bricks = len(BRICK_LIST)
    Person.moveup(PERSON)
    for i in range(PERSON.jump):
        Scene.brick_coin()
        Person.movedown(PERSON, 'w')

    Person.moveup(PERSON)
    for i in range(PERSON.jump):
        Scene.brick_coin()
        Person.movedown(PERSON, 'w')

    # print(Manage.score)
    # Board.board_initialise(BOARD,0)
    Scene.make_cm(0)
    Scene.brick_coin()
    final_bricks = len(BRICK_LIST)
    assert Manage.score > 0 and final_bricks == initial_bricks - 1


# test_score_brick()
Esempio n. 3
0
def test_brickcollision1():
    '''Collision while coming down with the brick'''
    Scene.make_cm(0)
    PERSON.xpos = 25
    PERSON.ypos = 34
    PERSON.jump = 8
    Scene.brick_coin()
    Person.moveup(PERSON)

    for i in range(PERSON.jump - 1):
        Person.movedown(PERSON, 'w')

    # Board.board_initialise(BOARD,0)
    Scene.make_cm(0)
    Scene.brick_coin()
    Person.print_on_board(PERSON, PERSON.xpos, PERSON.ypos)
    Board.print_on_board(BOARD, 0, 80)
    # print(Manage.score)
    s1 = Manage.score
    Person.moveright(PERSON)
    Scene.brick_coin()
    # Board.board_initialise(BOARD,0)
    Scene.make_cm(0)
    Scene.brick_coin()
    s2 = Manage.score
    Person.print_on_board(PERSON, PERSON.xpos, PERSON.ypos)
    Board.print_on_board(BOARD, 0, 80)
    assert s1 == s2
Esempio n. 4
0
def test_coin4():
	'''collect 2 coins at a time'''
	Scene.make_cm(80)
	PERSON.xpos = 25
	PERSON.ypos = 153
	Scene.brick_coin()
	# print(Manage.score)
	s1 = Manage.score
	Person.moveup(PERSON)
	Scene.brick_coin()
	# print(Manage.score)
	s2 = Manage.score
	assert s2 - s1 == 20

# test_coin4()
Esempio n. 5
0
def test_brickcollision2():
    '''collision when 1 unit ahead of brick'''
    Scene.make_cm(0)
    PERSON.xpos = 25
    PERSON.ypos = 38
    PERSON.jump = 8
    Scene.brick_coin()

    Person.moveup(PERSON)
    # print(PERSON.xpos,PERSON.ypos)
    s1 = Manage.score
    prev_x = PERSON.xpos
    Person.movedown(PERSON, 'w')
    while prev_x != PERSON.xpos:
        prev_x = PERSON.xpos
        Scene.brick_coin()
        Person.movedown(PERSON, 'w')
    s2 = Manage.score
    # print(s1,s2)
    assert s2 > s1
Esempio n. 6
0
def test_coin2():
	'''collect coin from left'''
	Scene.make_cm(0)
	PERSON.xpos = 25
	PERSON.ypos = 3
	PERSON.jump = 8
	Scene.make_pps()
	Scene.brick_coin()

	for i in range(61):
		Person.moveright(PERSON)

	Person.moveup(PERSON)
	Person.moveright(PERSON)

	prev_x = PERSON.xpos
	Person.movedown(PERSON,'w')
	while prev_x != PERSON.xpos:
		prev_x = PERSON.xpos
		Person.movedown(PERSON,'w')

	Person.moveup(PERSON)
	for _ in range(5):
		Person.moveright(PERSON)

	prev_x = PERSON.xpos
	Person.movedown(PERSON,'w')
	while prev_x != PERSON.xpos:
		prev_x = PERSON.xpos
		Person.movedown(PERSON,'w')
	
	Person.moveleft(PERSON,0)
	# print(PERSON.xpos,PERSON.ypos)
	# print(Manage.score)
	s1 = Manage.score
	Scene.brick_coin()
	# print(Manage.score)
	s2 = Manage.score
	assert s2 > s1
Esempio n. 7
0
def test_coin1():
	'''collect coin from right'''
	Scene.make_cm(0)
	Scene.make_pps()
	Scene.brick_coin()

	for i in range(61):
		Person.moveright(PERSON)

	Person.moveup(PERSON)
	Person.moveright(PERSON)

	prev_x = PERSON.xpos
	Person.movedown(PERSON,'w')
	while prev_x != PERSON.xpos:
		prev_x = PERSON.xpos
		Person.movedown(PERSON,'w')
	# print(PERSON.xpos,PERSON.ypos)
	Person.moveright(PERSON)
	Scene.brick_coin()
	# print(Manage.score)

	assert Manage.score > 0
Esempio n. 8
0
from manage import Manage

SCENE = Scene()
M = Manage()
i = 0
MID = 0
TIMER = 0
os.system('aplay -q ./mario-theme.wav&')
while i <= BOARD.width - 80:
    if PERSON.xpos == 25 and PERSON.ypos == 504:
        break
    os.system("clear")
    M.printhead()
    SCENE.make_cm(i)
    SCENE.make_pps()
    SCENE.brick_coin()
    SCENE.moving_bar()
    SCENE.make_flag()
    i = SCENE.enemy(i)
    # PERSON.print_mario(PERSON.xpos,PERSON.ypos)
    POLY.print_poly(PERSON, PERSON.xpos, PERSON.ypos)
    # BOARD.print_board(i,i+80)
    POLY.print_poly(BOARD, i, i + 80)
    # PERSON.move(i)
    POLY.move_poly(PERSON, i)
    if BOARD.checkstar(PERSON.xpos + 1, PERSON.ypos) == 2:
        Manage.changelives()
        ZPS = 0
        for k, j in CHECKPOINT:
            if j >= PERSON.ypos:
                PERSON.xpos = CHECKPOINT[ZPS - 1][0]