@@ -1,153 +1,153 @@
Pokedex = {
"bulbasaur" = [1, ["grass", "poison"]],
"ivysaur" = [2, ["grass", "poison"]],
"venusaur" = [3, ["grass", "poison"]],
"charmander" = [4, ["fire"]],
"charmeleon" = [5, ["fire"]],
"charizard" = [6, ["fire", "flying"]],
"squirtle" = [7, ["water"]],
"wartortle" = [8, ["water"]],
"blastoise" = [9, ["water"]],
"caterpie" = [10, ["bug"]],
"metapod" = [11, ["bug"]],
"butterfree" = [12, ["bug", "flying"]],
"weedle" = [13, ["bug", "poison"]],
"kakuna" = [14, ["bug", "poison"]],
"beedrill" = [15, ["bug", "poison"]],
"pidgey" = [16, ["normal", "flying"]],
"pidgeotto" = [17, ["normal", "flying"]],
"pidgeot" = [18, ["normal", "flying"]],
"rattatta" = [19, ["normal"]],
"raticate" = [20, ["normal"]],
"spearow" = [21, ["normal", "flying"]],
"fearow" = [22, ["normal", "flying"]],
"ekans" = [23, ["poison"]],
"arbok" = [24, ["poison"]],
"pikachu" = [25, ["electric"]],
"raichu" = [26, ["electric"]],
"sandshrew" = [27, ["ground"]],
"sandslash" = [28, ["ground"]],
"nidoranF" = [29, ["poison"]],
"nidorina" = [30, ["poison"]],
"nidoqueen" = [31, ["poison", "ground"]],
"nidoranM" = [32, ["poison"]],
"nidorino" = [33, ["poison"]],
"nidoking" = [34, ["poison", "ground"]],
"clefairy" = [35, ["normal"]],
"clefable" = [36, ["normal"]],
"vulpix" = [37, ["fire"]],
"ninetails" = [38, ["fire"]],
"jigglypuff" = [39, ["normal"]],
"wigglytuff" = [40, ["normal"]],
"zubat" = [41, ["flying", "poison"]],
"golbat" = [42, ["flying", "poison"]],
"oddish" = [43, ["grass", "poison"]],
"gloom" = [44, ["grass", "poison"]],
"vileplume" = [45, ["grass", "poison"]],
"paras" = [46, ["bug", "grass"]],
"parasect" = [47, ["bug", "grass"]],
"venonat" = [48, ["bug", "poison"]],
"venomoth" = [49, ["bug", "poison"]],
"diglet" = [50, ["ground"]],
"dugtrio" = [51, ["ground"]],
"meowth" = [52, ["normal"]],
"persian" = [53, ["normal"]],
"psyduck" = [54, ["water"]],
"golduck" = [55, ["water"]],
"mankey" = [56, ["fighting"]],
"primeape" = [57, ["fighting"]],
"growlithe" = [58, ["fire"]],
"arcanine" = [59, ["fire"]],
"poliwag" = [60, ["water"]],
"poliwhirl" = [61, ["water"]],
"poliwrath" = [62, ["water", "fighting"]],
"abra" = [63, ["psychic"]],
"kadabra" = [64, ["psychic"]],
"alakazam" = [65, ["psychic"]],
"machop" = [66, ["fighting"]],
"machoke" = [67, ["fighting"]],
"machamp" = [68, ["fighting"]],
"bellsprout" = [69, ["grass", "poison"]],
"weepinbell" = [70, ["grass", "poison"]],
"victreebel" = [71, ["grass", "poison"]],
"tentacool" = [72, ["water", "poison"]],
"tentacreul" = [73, ["water", "poison"]],
"geodude" = [74, ["rock", "ground"]],
"graveler" = [75, ["rock", "ground"]],
"golem" = [76, ["rock", "ground"]],
"ponyta" = [77, ["fire"]],
"rapidash" = [78, ["fire"]],
"slowpoke" = [79, ["water", "psychic"]],
"slowbro" = [80, ["water", "psychic"]],
"magnemite" = [81, ["electric", "steel"]],
"magneton" = [82, ["electric", "steel"]],
"farfetch'd" = [83, ["normal", "flying"]],
"doduo" = [84, ["normal", "flying"]],
"dodrio" = [85, ["normal", "flying"]],
"seel" = [86, ["water"]],
"dewgong" = [87, ["water", "ice"]],
"grimer" = [88, ["poison"]],
"muk" = [89, ["poison"]],
"shellder" = [90, ["water"]],
"cloyster" = [91, ["water", "ice"]],
"gastly" = [92, ["ghost", "poison"]],
"haunter" = [93, ["ghost", "poison"]],
"gengar" = [94, ["ghost", "poison"]],
"onyx" = [95, ["rock", "ground"]],
"drowzee" = [96, ["psychic"]],
"hypno" = [97, ["psychic"]],
"krabby" = [98, ["water"]],
"kingler" = [99, ["water"]],
"voltorb" = [100, ["electric"]],
"electrode" = [101, ["electric"]],
"exeggcute" = [102, ["grass", "psychic"]],
"exeggutor" = [103, ["grass", "psychic"]],
"cubone" = [104, ["ground"]],
"marowak" = [105, ["ground"]],
"hitmonlee" = [106, ["fighting"]],
"hitmonchan" = [107, ["fighting"]],
"lickitung" = [108, ["normal"]],
"koffing" = [109, ["poison"]],
"weezing" = [110, ["poison"]],
"ryhorn" = [111, ["ground", "rock"]],
"rhydon" = [112, ["ground", "rock"]],
"chansey" = [113, ["normal"]],
"tangela" = [114, ["grass"]],
"kangaskhan" = [115, ["normal"]],
"horsea" = [116, ["water"]],
"seadra" = [117, ["water"]],
"goldeen" = [118, ["water"]],
"seaking" = [119, ["water"]],
"staryu" = [120, ["water"]],
"starmie" = [121, ["water", "psychic"]],
"mr mime" = [122, ["psychic"]],
"scyther" = [123, ["bug", "flying"]],
"jynx" = [124, ["ice", "psychic"]],
"electabuzz" = [125, ["electric"]],
"magmar" = [126, ["fire"]],
"pinsir" = [127, ["bug"]],
"tauros" = [128, ["normal"]],
"magikarp" = [129, ["water"]],
"gyrados" = [130, ["water", "flying"]],
"lapras" = [131, ["water", "ice"]],
"ditto" = [132, ["normal"]],
"eevee" = [133, ["normal"]],
"vaporeon" = [134, ["water"]],
"jolteon" = [135, ["electric"]],
"flareon" = [136, ["fire"]],
"porygon" = [137, ["normal"]],
"omanyte" = [138, ["rock", "water"]],
"omastar" = [139, ["rock", "water"]],
"kabuto" = [140, ["rock", "water"]],
"kabutops" = [141, ["rock", "water"]],
"aerodactyl" = [142, ["rock", "flying"]],
"snorlax" = [143, ["normal"]],
"articuno" = [144, ["ice"]],
"zapdos" = [145, ["electric"]],
"moltres" = [146, ["fire"]],
"dratini" = [147, ["dragon"]],
"dragonair" = [148, ["dragon"]],
"dragonite" = [149, ["dragon", "flying"]],
"mewtwo" = [150, ["psychic"]],
"mew" = [151, ["psychic"]],
Pokedex: {
"bulbasaur": [1, ["grass", "poison"]],
"ivysaur": [2, ["grass", "poison"]],
"venusaur": [3, ["grass", "poison"]],
"charmander": [4, ["fire"]],
"charmeleon": [5, ["fire"]],
"charizard": [6, ["fire", "flying"]],
"squirtle": [7, ["water"]],
"wartortle": [8, ["water"]],
"blastoise": [9, ["water"]],
"caterpie": [10, ["bug"]],
"metapod": [11, ["bug"]],
"butterfree": [12, ["bug", "flying"]],
"weedle": [13, ["bug", "poison"]],
"kakuna": [14, ["bug", "poison"]],
"beedrill": [15, ["bug", "poison"]],
"pidgey": [16, ["normal", "flying"]],
"pidgeotto": [17, ["normal", "flying"]],
"pidgeot": [18, ["normal", "flying"]],
"rattatta": [19, ["normal"]],
"raticate": [20, ["normal"]],
"spearow": [21, ["normal", "flying"]],
"fearow": [22, ["normal", "flying"]],
"ekans": [23, ["poison"]],
"arbok": [24, ["poison"]],
"pikachu": [25, ["electric"]],
"raichu": [26, ["electric"]],
"sandshrew": [27, ["ground"]],
"sandslash": [28, ["ground"]],
"nidoranF": [29, ["poison"]],
"nidorina": [30, ["poison"]],
"nidoqueen": [31, ["poison", "ground"]],
"nidoranM": [32, ["poison"]],
"nidorino": [33, ["poison"]],
"nidoking": [34, ["poison", "ground"]],
"clefairy": [35, ["normal"]],
"clefable": [36, ["normal"]],
"vulpix": [37, ["fire"]],
"ninetails": [38, ["fire"]],
"jigglypuff": [39, ["normal"]],
"wigglytuff": [40, ["normal"]],
"zubat": [41, ["flying", "poison"]],
"golbat": [42, ["flying", "poison"]],
"oddish": [43, ["grass", "poison"]],
"gloom": [44, ["grass", "poison"]],
"vileplume": [45, ["grass", "poison"]],
"paras": [46, ["bug", "grass"]],
"parasect": [47, ["bug", "grass"]],
"venonat": [48, ["bug", "poison"]],
"venomoth": [49, ["bug", "poison"]],
"diglet": [50, ["ground"]],
"dugtrio": [51, ["ground"]],
"meowth": [52, ["normal"]],
"persian": [53, ["normal"]],
"psyduck": [54, ["water"]],
"golduck": [55, ["water"]],
"mankey": [56, ["fighting"]],
"primeape": [57, ["fighting"]],
"growlithe": [58, ["fire"]],
"arcanine": [59, ["fire"]],
"poliwag": [60, ["water"]],
"poliwhirl": [61, ["water"]],
"poliwrath": [62, ["water", "fighting"]],
"abra": [63, ["psychic"]],
"kadabra": [64, ["psychic"]],
"alakazam": [65, ["psychic"]],
"machop": [66, ["fighting"]],
"machoke": [67, ["fighting"]],
"machamp": [68, ["fighting"]],
"bellsprout": [69, ["grass", "poison"]],
"weepinbell": [70, ["grass", "poison"]],
"victreebel": [71, ["grass", "poison"]],
"tentacool": [72, ["water", "poison"]],
"tentacreul": [73, ["water", "poison"]],
"geodude": [74, ["rock", "ground"]],
"graveler": [75, ["rock", "ground"]],
"golem": [76, ["rock", "ground"]],
"ponyta": [77, ["fire"]],
"rapidash": [78, ["fire"]],
"slowpoke": [79, ["water", "psychic"]],
"slowbro": [80, ["water", "psychic"]],
"magnemite": [81, ["electric", "steel"]],
"magneton": [82, ["electric", "steel"]],
"farfetch'd": [83, ["normal", "flying"]],
"doduo": [84, ["normal", "flying"]],
"dodrio": [85, ["normal", "flying"]],
"seel": [86, ["water"]],
"dewgong": [87, ["water", "ice"]],
"grimer": [88, ["poison"]],
"muk": [89, ["poison"]],
"shellder": [90, ["water"]],
"cloyster": [91, ["water", "ice"]],
"gastly": [92, ["ghost", "poison"]],
"haunter": [93, ["ghost", "poison"]],
"gengar": [94, ["ghost", "poison"]],
"onyx": [95, ["rock", "ground"]],
"drowzee": [96, ["psychic"]],
"hypno": [97, ["psychic"]],
"krabby": [98, ["water"]],
"kingler": [99, ["water"]],
"voltorb": [100, ["electric"]],
"electrode": [101, ["electric"]],
"exeggcute": [102, ["grass", "psychic"]],
"exeggutor": [103, ["grass", "psychic"]],
"cubone": [104, ["ground"]],
"marowak": [105, ["ground"]],
"hitmonlee": [106, ["fighting"]],
"hitmonchan": [107, ["fighting"]],
"lickitung": [108, ["normal"]],
"koffing": [109, ["poison"]],
"weezing": [110, ["poison"]],
"ryhorn": [111, ["ground", "rock"]],
"rhydon": [112, ["ground", "rock"]],
"chansey": [113, ["normal"]],
"tangela": [114, ["grass"]],
"kangaskhan": [115, ["normal"]],
"horsea": [116, ["water"]],
"seadra": [117, ["water"]],
"goldeen": [118, ["water"]],
"seaking": [119, ["water"]],
"staryu": [120, ["water"]],
"starmie": [121, ["water", "psychic"]],
"mr mime": [122, ["psychic"]],
"scyther": [123, ["bug", "flying"]],
"jynx": [124, ["ice", "psychic"]],
"electabuzz": [125, ["electric"]],
"magmar": [126, ["fire"]],
"pinsir": [127, ["bug"]],
"tauros": [128, ["normal"]],
"magikarp": [129, ["water"]],
"gyrados": [130, ["water", "flying"]],
"lapras": [131, ["water", "ice"]],
"ditto": [132, ["normal"]],
"eevee": [133, ["normal"]],
"vaporeon": [134, ["water"]],
"jolteon": [135, ["electric"]],
"flareon": [136, ["fire"]],
"porygon": [137, ["normal"]],
"omanyte": [138, ["rock", "water"]],
"omastar": [139, ["rock", "water"]],
"kabuto": [140, ["rock", "water"]],
"kabutops": [141, ["rock", "water"]],
"aerodactyl": [142, ["rock", "flying"]],
"snorlax": [143, ["normal"]],
"articuno": [144, ["ice"]],
"zapdos": [145, ["electric"]],
"moltres": [146, ["fire"]],
"dratini": [147, ["dragon"]],
"dragonair": [148, ["dragon"]],
"dragonite": [149, ["dragon", "flying"]],
"mewtwo": [150, ["psychic"]],
"mew": [151, ["psychic"]],
}
55 tile.py
@@ -1,42 +1,33 @@
from berry import Berry

import random

def frange(start, stop, step):
i = start
while i < stop:
yield i
i += step
import time

class Tile(object):
def __init__(self, player):
def __init__(self):
self.berry = None
self.stage = 0
self.player = player

def plantBerry(self, berryName):
#if the button was pressed after the berry finished growing:
if self.stage >= 4:
if self.berry.name in self.player.berries:
self.player.berries[self.berry.name] += 2
else:
self.player.berries[self.berry.name] = 2
self.stage = 0
#if the button was pressed and there were no berries and there is not a berry growing:
elif self.player.berries[berryName] <= 0 and not self.berry:
self.flashText("not enough berries")
#if the button was pressed and there is not a berry growing"
elif not self.berry:
self.player.berries[berryName] -= 1
self.berry = Berry(berryName)
self.text = "growing %s berry" % self.berry.name
self.background_color = self.berry.hue + [1]
Clock.schedule_once(lambda _: self.growBerry(self), .75)
def plant(self, berryKind):
self.berry = Berry(berryKind)
self.stage = 0
self.time = time.time()

def growBerry(self, tile): # called every frame
if self.stage < 4:
self.stage += 1
newTime = random.choice([i for i in frange(self.berry.ripeTime-.25, self.berry.ripeTime+.25, .01)])
Clock.schedule_once(lambda _: self.growBerry(self), newTime)
def update(self):
if self.berry:
timeDiff = time.time() - self.time
if timeDiff > (self.berry.growTime) and not self.stage == "ripe":
self.time = time.time()
self.stage += 1
if self.stage >= 4:
self.stage = "ripe"

def pick(self):
if self.stage == "ripe":
berry = self.berry.name
self.time = None
self.stage = 0
self.berry = None
return berry
else:
self.text = "harvest"
return False