コード例 #1
0
3. Randomized which image would appear at the end
4. Lowered numbers allowed in game
"""
from random import *
from turtle import *
from time import *
from sys import *
from freegames import path
import os

#This holds the value of the current working directory for easier file referencing
cwd = os.path.dirname(os.path.realpath(__file__))

#Creating the picture and tile objects
image_dic = {}  #Making a random image to appear when doing puzzle
image_dic['car'] = path(cwd + '/car.gif')
image_dic['dino'] = path(cwd + '/dinosaur.gif')
image_dic['house'] = path(cwd + '/house.gif')
image_dic['dog'] = path(cwd + '/dog.gif')
image_dic['nova'] = path(cwd + '/supernova.gif')
image = choice(list(image_dic.values()))
tiles = list(range(8)) * 2
state = {'mark': None}
hide = [True] * 16


#Creating a square plus its size components
def square(x, y):
    "Draw white square with black outline at (x, y)."
    up()
    goto(x, y)
コード例 #2
0
Exercises:

1. Count and print how many taps occur.
2. Decrease the number of tiles to a 4x4 grid.
3. Detect when all tiles are revealed.
4. Center single-digit tile.
5. Use letters instead of tiles.

"""

from random import *
from turtle import *
from freegames import path

car = path('car.gif')
tiles = list(range(32)) * 2
state = {'mark': None}
hide = [True] * 64


def square(x, y):
    "Draw white square with black outline at (x, y)."
    up()
    goto(x, y)
    down()
    color('black', 'white')
    begin_fill()
    for count in range(4):
        forward(50)
        left(90)
コード例 #3
0
Exercises:
1. Count and print how many taps occur.
2. Decrease the number of tiles to a 4x4 grid.
3. Detect when all tiles are revealed.
4. Center single-digit tile.
5. Use letters instead of tiles.
"""

from random import *
from turtle import *
from time import *
from sys import *
from freegames import path

image_dic = {}
image_dic['car'] = path('car.gif')
image_dic['sea'] = path('sea.gif')
image_dic['jellyfish'] = path('jellyfish.gif')

image = choice(list(image_dic.values()))

tiles = list(range(32)) * 2
state = {'mark': None}
hide = [True] * 64

def square(x, y):
    "Draw white square with black outline at (x, y)."
    up()
    goto(x, y)
    down()
    color('black', 'white')
コード例 #4
0
ファイル: memory.py プロジェクト: MaxXuXu/free-python-games
Exercises:

1. Count and print how many taps occur.
2. Decrease the number of tiles to a 4x4 grid.
3. Detect when all tiles are revealed.
4. Center single-digit tile.
5. Use letters instead of tiles.

"""

from random import *
from turtle import *
from freegames import path

car = path('car.gif')
tiles = list(range(32)) * 2
state = {'mark': None}
hide = [True] * 64

def square(x, y):
    "Draw white square with black outline at (x, y)."
    up()
    goto(x, y)
    down()
    color('black', 'white')
    begin_fill()
    for count in range(4):
        forward(50)
        left(90)
    end_fill()
コード例 #5
0
Exercises:

1. Count and print how many taps occur.
2. Decrease the number of tiles to a 4x4 grid.
3. Detect when all tiles are revealed.
4. Center single-digit tile.
5. Use letters instead of tiles.

"""

from random import *
from turtle import *
from freegames import path

image = {
    'car': path('car.gif'),
    'sea': path('sea.gif'),
    'jellyfish': path('jellyfish.gif')
}
image = choice(list(image_dic.values()))

tiles = list(range(32)) * 2
state = {'mark': None}
hide = [True] * 64


def square(x, y):
    "Draw white square with black outline at (x, y)."
    up()
    goto(x, y)
    down()
コード例 #6
0
ファイル: memorygame.py プロジェクト: TheRealMilesLee/Python
from random import *
from turtle import *
from freegames import path

car = path("car.gif")
tiles = list(range(32)) * 2
state = {"mark": None}
hide = [True] * 64


def square(x, y):
    "Draw white square with black outline at (x, y)."
    up()
    goto(x, y)
    down()
    color("black", "white")
    begin_fill()
    for count in range(4):
        forward(50)
        left(90)
    end_fill()


def index(x, y):
    "Convert (x, y) coordinates to tiles index."
    return int((x + 200) // 50 + ((y + 200) // 50) * 8)


def xy(count):
    "Convert tiles count to (x, y) coordinates."
    return (count % 8) * 50 - 200, (count // 8) * 50 - 200
コード例 #7
0
# todo este curso me permitio ver que el desarrollo de videojuegos no esta tan lejos de nosotros y que incluso no
# siendo experto podemos trabajar en juegos clasicos y desarrollarlos lo que me lleva a querer aprender mas sobre
# ambito y querer seguir aprendiendo sobre el desarrollo de videojuegos.

# Link video: https://youtu.be/1Bh7eB99CkE
# Link Github: https://github.com/MiguelEscajeda/Practicas.git

from random import *
from turtle import *
from freegames import path

# Regresa el full path to 'filname' in freegames module

# Llama a la imagen modificada

car = path('car2.gif')

# Indica la baraja que sera utilizada

tiles = ['Pera','Manzana','Mango','Fresa','Kiwi','Sandia','Melon','Durazno','Aguacate','Zanahoria','Granada','Calabaza','Berenjena','Papaya','Naranja','Toronja',
         'Mandarina','Uva','Mora','Cereza','Cebolla','Brocoli','Rabano','Arandano','Frambuesa',
         'Guayaba', 'Limon','Piña','Platano','Coco','Ciruela','Higo'] * 2
state = {'mark': None}
hide = [True] * 64
taps = 0
writer=Turtle(visible=False)

# Funcion encargada de dibujar los cuadrados del tablero

def square(x, y):
    "Draw white square with black outline at (x, y)."