Esempio n. 1
0
def exit():
    view0 = View.views[0]
    view0.use()
    pc.SDL_DestroyRenderer(view0.renderer)
    pc.SDL_DestroyWindow(view0.window)

    View.views[1].use()
    pc.close_canvas()
Esempio n. 2
0
def main():
    pico2d.open_canvas()
    running = True
    enter()
    while running:
        handle_events()
        update()
        draw()
    exit()
    pico2d.close_canvas()
Esempio n. 3
0
def main():
    mainE = MainE()
    mainM = MainM()
    mainH = MainH()
    mainE.Init()
    mainM.Init()
    mainH.Init()

    while (scene >= 0):
        while (scene == 0):
            p2.clear_canvas()

            mainE.draw()
            p2.update_canvas()
            p2.delay(0.1)

            handle_events()

        while (scene == 1):
            p2.clear_canvas()

            mainM.draw()
            p2.update_canvas()
            p2.delay(0.1)

            handle_events()

        while (scene == 2):
            p2.clear_canvas()

            mainH.draw()
            p2.update_canvas()
            p2.delay(0.1)

            handle_events()

    p2.close_canvas()
Esempio n. 4
0
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:57:54) [MSC v.1924 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import pico2d
Pico2d is prepared.
>>> pico2d.open_canvas()
>>> pico2d.close_canvas()
>>> import pico2d as p
>>> p.open_canvas()
p
>>> p.close_canvas()
>>> open_canvas()
Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    open_canvas()
NameError: name 'open_canvas' is not defined
>>> from random import randint
>>> randint(1,6)
2
>>> 
>>> 
>>> randint(1,6)
5
>>> randint(1,6)
1
>>> from random import randint as ri
>>> ri(1,6)
6
>>> from random import *
>>> uniform(1,2)
1.0964769400655285
>>> randrange(10,20)
Esempio n. 5
0
import game_framework
import pico2d
import os

import start_state
import pause_state

os.chdir("assets")

pico2d.open_canvas()
game_framework.run(start_state)
pico2d.close_canvas()
# fill here
Esempio n. 6
0
def start():
    pico2d.open_canvas(1200,900,True)
    C_Game_framework.run(C_title_state)
    pico2d.close_canvas()
Esempio n. 7
0
import pico2d as Pico

Pico.open_canvas()

Grass = Pico.load_image('../res/grass.png')
Character = Pico.load_image('../res/run_animation.png')

x = 0
FrameIndex = 0

while x < 800 :
    Pico.clear_canvas()
    Grass.draw(400,30)
    Character.clip_draw(100 * FrameIndex, 0, 100, 100, x, 85)
    Pico.update_canvas()

    Pico.get_events()

    x += 4

    #FrameIndex += 1
    #if FrameIndex >= 8 :
    #    FrameIndex = 0

    FrameIndex = (FrameIndex + 1) % 8

    Pico.delay(0.05)


Pico.close_canvas()
Esempio n. 8
0
char = p.load_image('animation_sheet.png')
LEFT = 1073741904
RIGHT = 1073741903
UP = 1073741906
DOWN = 1073741905
while (True):
    p.clear_canvas()
    grass.draw(640, 512)
    if direct == Direct.e_right:
        if state == State.e_idle:
            char.clip_draw(frame * 100, 300, 100, 100, cx, cy)
        else:
            char.clip_draw(frame * 100, 100, 100, 100, cx, cy)
    else:
        if state == State.e_idle:
            char.clip_draw(frame * 100, 200, 100, 100, cx, cy)
        else:
            char.clip_draw(frame * 100, 0, 100, 100, cx, cy)
    p.update_canvas()
    frame = (frame + 1) % 8
    handle_events()
    if myInput[0] == True and cx < 1280:
        cx += 1
    if myInput[1] == True and cx > 0:
        cx -= 1
    if myInput[2] == True and cy > 0:
        cy -= 1
    if myInput[3] == True and cy < 1024:
        cy += 1
p.close_canvas()