Wednesday, February 26, 2014

pygame grid

#Trying to make a sprite drawing program... click on the squares/rects
#make a sprite, save image.  Haven't figured out it all yet. Just a grid.
 # the actual GRID is only 4 lines of code plus the variables.  I'll mark em.


import pygame
from pygame.locals import*
from pygame import time
import random
import sys

pygame.init()
#############  GRID VARIABLES ########
WINDOWWIDTH = 800
WINDOWHEIGHT = 800
CELLSIZE = 10
CELLWIDTH = int(WINDOWWIDTH/CELLSIZE)
CELLHEIGHT = int(WINDOWHEIGHT/CELLSIZE)
#####################################
#always rainbows.    
x1 = random.randint(0, 255)
y1 = random.randint(10, 245)
z1 = random.randint(15, 200)
   
RAINBOW1 = (x1, y1, z1)
GREY = (200, 200, 200)
BLUE = (0, 0, 255)
BLUE1 = (0, 0, 230)
BLUE2 = (50, 0, 250)
RED = (210, 0, 0)
RED2 = (255, 20, 50)
WHITE = (255, 250, 250)
GREEN = (0, 255, 0)
BLACK = (0, 0, 0)



pygame.init()
   


SCREEN = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))   
SCREEN.fill((255, 255, 255))

pygame.display.update()
clock = pygame.time.Clock

z = 0

FONT = pygame.font.Font('freesansbold.ttf', 18)
pygame.display.set_caption("Make a Sprite")   
######################GRID ###########################
     
for x in range(0, WINDOWWIDTH, CELLSIZE):
    pygame.draw.line(SCREEN, BLACK, (x, 0), (x, WINDOWHEIGHT))
for y in range(0, WINDOWHEIGHT, CELLSIZE):
    pygame.draw.line(SCREEN, BLACK, (0, y), (WINDOWWIDTH, y))   

#######################GRID##########################

while True:
   
    (a,b) = pygame.mouse.get_pos()

    for event in pygame.event.get():
        if event.type == QUIT:
            sys.exit()
       
   

silly one.

#brain fried.  Need to sleep. 
#Here's my pooping unicorn as of now.... but the unicorn is invisible. 

import pygame
import random
import sys

from pygame.locals import*

background_image_file = 'CRSwall.jpg'
mouse_image_file = 'brush.png'
   


def main():   
    pygame.init()
   
    SCREEN = pygame.display.set_mode((600,800))
    pygame.display.set_caption('Nellie wants to be a Geek!')
   
    BACKGROUND = pygame.image.load(background_image_file).convert()
    mouse_cursor = pygame.image.load(mouse_image_file).convert()
   
   
    SCREEN.blit(BACKGROUND,(-10, -10))
   
    x1 = random.randint(0, 255)
    y1 = random.randint(10, 245)
    z1 = random.randint(15, 200)
   
    RAINBOW1 = (x1, y1, z1)

    BLACK = (0, 0, 0)
    WHITE = (255, 255, 255)
    PURPLE = (255, 0, 220)
    BLUE = (74, 74, 250)

    font = pygame.font.Font(None, 49)
    text = font.render("Pooping Unicorn! Clicky clicky!", False, RAINBOW1)
    textPos = text.get_rect()
    textPos.centerx = BACKGROUND.get_rect().centerx
   
    pygame.draw.rect(BACKGROUND, (100, 255, 255), (0, 0, 600, 60))
    pygame.draw.rect(SCREEN, (255, 200, 50), (800, 0, 600, 60))
   
   
    (mouseX, mouseY) = pygame.mouse.get_pos()
    pygame.draw.circle(BACKGROUND, (RAINBOW1), (mouseX, mouseY), 20, 20)
    x1 = random.randint(0, 255)
    y1 = random.randint(10, 245)
    z1 = random.randint(15, 200)
    RAINBOW1 = (x1, y1, z1)

    pygame.display.update()
    #screen.blit(ball.image, ball.rect)
    BACKGROUND.blit(text, textPos)   
        SCREEN.blit(BACKGROUND, (0,0))       
    pygame.display.flip()

    while 1:   
       
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()   
            if event.type == MOUSEBUTTONDOWN :
                main()
               
                BACKGROUND.blit(text, textPos)
                SCREEN.blit(mouse_cursor.image, mouse_cursor.rect)

if __name__ == '__main__': main()

   

Sunday, February 23, 2014

example of Python Class order of operations

##  Meggamuffins is my name!  Eating mushrooms is NOT my game!
#When you run this in terminal, it should show you how the order is written backwards,
# but the computer processes it bottom up.
## ALL props to Zed Shaw and his amazing learning tools.  http://learnpythonthehardway.org
class Meggamuffins(object):

    def __init__(self, gamedata):
       
        self.gamedata = gamedata
        def wingame(self):
            print "wingame = self"
            print "that is the entire list, if it all printed off, then it worked!"
        def endgame(self):
            print "endgame =  endgame"
            wingame(self)
        def battle(storyline, enemy, hero, level_up, npc):
            print "battle = storyline, enemy, hero, level_up, npc"
            endgame(self)
        def level_up(self, hero, inventory, storyline):
            print "self, hero, inventory, storyline"
            battle(storyline, enemy, hero, level_up, npc)
        def enemy_position(self, storyline, areamap, hero):
            print "enemy_position = self, storyline, areamap, hero"
            level_up(self, hero, inventory, storyline)
        def enemy(self, inventory):
            print "enemy = self, inventory)"
            enemy_position(self, storyline, areamap, hero)
        def hero_position(self, storyline, areamap, hero):
            print "hero_position = self, storyline, areamap, hero"
            enemy(self, inventory)
        def hero(self, storyline, areamap, inventory):
            print " Hero = self, storyline, areamap, inventory"
            hero_position(self, storyline, areamap, hero)
        def npc_position(self, storyline, areamap):
            print "npc_position = self, storyline, areamap)"
            hero(self, storyline, areamap, inventory)
        def npc(self, storyline, areamap, inventory):
            print "npc = self, storyline, areamap"
            npc_position(self, storyline, areamap)
        def inventory(self):
            print "inventory =  self"
            npc(self, storyline, areamap, inventory)
        def areamap(self, storyline):
            print "areamap = self, storyline"
            inventory(self)
        def storyline(self, areamap):
            print "storyline"
            areamap(self, storyline)
               
        def start(self):
            print "start"
            storyline(self, areamap)
       
        start(self)
   
   
   
           
           
## I have NO IDEA why we have to rename this object to call it.
## why can't I just type, Meggamuffins.gamedata(object)???
redundantnaming = Meggamuffins(object)
redundantnaming.gamedata()
   
   

Friday, February 21, 2014

personality test python

#personality test, cleaned up a little

import sys

question_list = [" 1. You have stepped on a bee, and it died stinging you.",
                " 2. An elderly lady is in the way at the liquor store, and can't hear you asking her to move.",
                " 3. A strangers child has knocked over your morning coffee with his large bouncy ball.",
                " 4. Someone is trying to dramatically tell you a story about thier trip to the zoo.",
                " 5. A clicking noise is getting louder as you try to rest.",
                " 6. Someone has defiled a church and placed thier landmark cross upside down.",
                " 7. You have awakened in a field of cotton candy blossoms whose neon filimants light up the sky.",
                " 8. The bicyclist in front of you refuses to get off the road and continues to ride in the middle even as you honk.",
                " 9. The voices say what?",
                " 10. A woman has sneezed and blood splatters on the floor in front of you.",
                " 11. A mysterious and dangerous looking individual is approaching you rapidly.",
                 "12. Are you tierd of questions?"]
               
one_results = {'a': 'so boringly normal.', 'b': 'At least you have an epipen. Right?',
                'c': 'Yea, I step on bees all the time.', 'd': 'Raid? Hell no, we got napalm.',
                'e': 'Sure, yell at it as it dies.', 'f': 'What makes you say that?',
                'g': 'Seriously? It is just a bee.'}
two_results = {'a': 'Kicking is fun. Alch-y.', 'b': 'Maybe if you yell explatives she will notice.',
                'c': 'Eh, you can get booze somewhere else.', 'd': 'throwing pine-sol at her might actually work.',
                'e': 'well maybe she can hear you, but the Captain Morgans is not going to fetch itself!',
                'f': 'but louder right?', 'g': 'That is illegal in 30 states.'}
three_results = {'a': 'again with the normal boring stuff!', 'b': 'At least you did not cry... did you?',
                'c': 'I aknowlege your suffering.', 'd': 'Fart in a can is the best for use in closed spaces. Kids love it.',
                'e': 'Did I mention the kids parent is extremely hot?', 'f': 'It was really good coffee after all.',
                'g': 'Uh-huh, and how long have you had these reactions?'}
four_results = {'a': 'It might work, but to what end?', 'b': 'It stuns them into silence. Good job!',
                'c': 'If they follow you, does the tree still fall in the woods?', 'd': 'Bleach... It might just burn thier throte enough...',
                'e': 'There is no try, only do!', 'f': 'Fine, I will kick them for you.', 'g': 'How are you going to get that into thier mouth?'}
five_results = {'a': 'normal is as normal does.', 'b': 'What because it might be something comming to get you?', 'c': 'My faucet leaks too.',
                'd': 'I love the smell of Lysol in the morning!', 'e': 'That does seem like a logical solution.',
                'f': 'Anything in particular, or the first thing that comes near?', 'g': 'Pretty sure you are not supposed to stick those in your ears.'}
six_results = {'a': 'Owww, oww owwy!', 'b': 'Sure, now you are a suspect.', 'c': 'Ninny ninny two by two, nothing left for you to do.',
                'd': 'Satan loves germs!', 'e': 'Oh, ok, but I really think you should explore this.', 'f': 'Are there three more churches near by?',
                'g': 'Hardly, the thing weighs 800 lbs!'}
seven_results = {'a': 'that seems inappropriate.', 'b': 'I think that is probably appropriate, next to wondering WTF.', 'c': 'LSD normal, or everyday normal?',
                'd': 'Might as well, reality is not working for you.', 'e': 'Louder then the growling Ninny-eater sitting over you?',
                'f': 'Yup, let me just write that down.', 'g': 'Cotton candy does sound delicious.'}
eight_results = {'a': 'Gas pedal or brake?', 'b': 'At least if you startle them, they might move.', 'c': 'or drive away...ninny',
                'd': 'Because they are sweaty gross bicyclist?', 'e': 'In a court of law, "I did not see them" will not fly.',
                'f': 'Honk, honk, honk.', 'g': 'So you are saying that you are not angry?'}
nine_results = {'a': 'Do not worry, I will not write that down...(writing quickly)', 'b': 'So more like panic, or dread?', 'c': 'Sure, it all makes sense now.',
                'd': 'Well as long they do not want you to drink it.', 'e': 'If it works, let me know.', 'f': 'Do the voices know what 51-50 means?',
                'g': 'That is very interesting. (run.... run now.)'}
ten_results = {'a': 'Make sure you wash your shoe afterward.', 'b': 'Bless you might have been better.', 'c': 'Good idea. Spread the plague to everyone.',
                'd': 'Splendid response.', 'e': 'You like that word?', 'f': 'Because blood is awesome.', 'g': 'It is for the good of all mankind.'}
eleven_results = {'a': 'Sure, kicking is always my first reaction.', 'b': 'Did I mention the individual is mute?',
                'c': 'Probably best. Ninny.', 'd': 'Especially if they touch you.',
                'e': 'It is ok not to answer.(ninny)', 'f': 'how about we just touch some lamposts and go watch monk?',
                'g': 'Is it legal for you to have that?'} #even responses.
twelve_results = {'a': 'eh, good thing I did not make it longer.', 'b': 'Results are gauranteed to be unprofessional, uneducated guesses. Ninny.',
                'c': 'Been on that couch a lot have you?', 'd': 'Please refrain from huffing until test is complete.', 'e': 'Ok, ok, I heard you.',
                'f': 'awww, it was not that bad.', 'g': 'I give, here are your results.'}  # odd responses.
def start_test():
    print "\n " * 4
    print "Here are your questions. \n Answer closest to your first response or 'g' for something not listed."
    print "You will recieve..... \n an uneducated, \n unprofessional, \n and totally unsactioned diagnosis at the end."
    print "\n" * 2
odd_choices = {'a': 'low anger',
                'b': 'anxiety',
                'c': 'nothing, this is normal',
                'd': 'There is a can of gas that needs some using.',
                'e': 'Be louder, that always works.',
                'f': 'just kill.',
                'g': 'other'
                }

printable_odd_choice = """
                a = low anger \n
                b = anxiety \n
                c = nothing, this is normal \n
                d = There is a can of gas that needs some using \n
                e = Be louder, that always works \n
                f = just kill \n
                g = other
                """
even_choices = {'a': 'kick something/someone',
                'b': 'yell Shut the F--k up',
                'c': 'walk away',
                'd': 'always disinfect. Or run to nearest medical facility.',
                'e': 'no',
                'f': 'maybe if we do it 3 more times.',
                'g': 'other'}

printable_even_choice = """
                a = kick something/someone \n
                b = Yell Shut the F--k up \n
                c = walk away \n
                d = always disinfect. Or run to the nearest medical center. \n
                e = no \n
                f = maybe if we do it 3 more times. \n
                g = other
                """

# A = "angry much?" B = "Passive aggresive is always fun", C = "Normal Ninny", D = "Munch-Howsens, or Sound mind", E = "Deaf, or narcasistic"
# F = OCD, or Friggen Nuts, G = Indecisive or Friggen Nuts, H = Friggen Nuts.
def personality_quiz():
    score_a = 0
    score_b = 0
    score_c = 0
    score_d = 0
    score_e = 0
    score_f = 0
    score_g = 0
    score_h = 0
    x = 0
    while x == 0:
        print question_list[int(x)]
        print printable_odd_choice
        answer = raw_input("Choose the one closest to your first response.")
        if answer in one_results:
            print '--- \n \n \n '
            print one_results[answer]
            print '--- \n \n \n'
            break
        else:
            print "Please use keys a-->g"
            x = 0
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
    x = 1
    while x == 1:
        print question_list[1]
        print printable_even_choice
        answer = raw_input("Choose the one closest to your first response.")
        if answer in two_results:
            print '--- \n \n \n '
            print two_results[answer]
            print '--- \n \n \n'
            break
        else:
            print "Please use keys a-->g"
            x = 0
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
    x = 2
    while x == 2:
        print question_list[2]
        print printable_odd_choice
        answer = raw_input(">>> ")
        if answer in three_results:
            print '--- \n \n \n '
            print three_results[answer]
            print '--- \n \n \n'
            break
           
        else:
            print "Please use keys a-->g"
            x = 2
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
    x = 3
    while x == 3:
        print question_list[3]
        print printable_even_choice
        answer = raw_input(">>> ")
        if answer in four_results:
            print '--- \n \n \n'
            print four_results[answer]
            print '--- \n \n \n'
            break
        else:
            print "Please use keys a-->g"
            x = 3
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
        x = 4
    while x == 4:
        print question_list[4]
        print printable_odd_choice
        answer = raw_input(">>> ")
        if answer in five_results:
            print '--- \n \n \n '
            print five_results[answer]
            print '--- \n \n \n'
            break
        else:
            print "Please use keys a-->g"
            x = 4
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
    x = 5
    while x == 5:
        print question_list[5]
        print printable_even_choice
        answer = raw_input(">>> ")
        if answer in six_results:
            print ' --- \n \n \n'
            print six_results[answer]
            print '--- \n \n \n'
            break
        else:
            print "Please use keys a-->g"
            x = 5
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
    x = 6
    while x == 6:
        print question_list[6]
        print printable_odd_choice
        answer = raw_input(">>> ")
        if answer in seven_results:
            print ' --- \n \n \n'
            print seven_results[answer]
            print '--- \n \n \n'
            break
        else:
            print "Please use keys a-->g"
            x = 6
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
    x = 7
    while x == 7:
        print question_list[7]
        print printable_even_choice
        answer = raw_input(">>> ")
        if answer in eight_results:
            print ' --- \n \n \n'
            print eight_results[answer]
            print '--- \n \n \n'
            break
        else:
            print "Please use keys a-->g"
            x = 7
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
    x = 8
    while x == 8:
        print question_list[8]
        print printable_odd_choice
        answer = raw_input(">>> ")
        if answer in nine_results:
            print ' --- \n \n \n'
            print nine_results[answer]
            print '--- \n \n \n'
            break
        else:
            print "Please use keys a-->g"
            x = 8
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
    x = 9
    while x == 9:
        print question_list[9]
        print printable_even_choice
        answer = raw_input(">>> ")
        if answer in ten_results:
            print ' --- \n \n \n'
            print ten_results[answer]
            print '--- \n \n \n'
            break
        else:
            print "Please use keys a-->g"
            x = 9
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
        x = 10
    while x == 10:
        print question_list[10]
        print printable_even_choice
        answer = raw_input(">>> ")
        if answer in eleven_results:
            print ' --- \n \n \n'
            print eleven_results[answer]
            print '--- \n \n \n'
            break
        else:
            print "Please use keys a-->g"
            x = 10
            x != 12
    if 'a' in answer:
        score_a += 1
    if 'b' in answer:
        score_b += 2
        score_a += 2
    if 'c' in answer:
        score_c += 5
        score_g += 1
    if 'd' in answer:
        score_d += 3
        score_e += 1
        score_g += 1
        score_f += 2
    if 'e' in answer:
        score_e += 5
        score_h += 2
    if 'f' in answer:
        score_f += 3
        score_h += 4
    if 'g' in answer:
        score_f += 2
        score_h += 3
    x = 11
    while x == 11:
        print question_list[11]
        print printable_odd_choice
        answer = raw_input(">>> ")
        if answer in twelve_results:
            print ' --- \n \n \n'
            print twelve_results[answer]
            print '--- \n \n \n'
            x = 12
    while x == 12:
            print "Your scores. If you score higher then 20 in any one catagorie..... wow. And quit cheating my game!"
            print "\n" * 2
            print "Anger index = %r" % score_a
            print "Passive aggressive 'or just an angry asshole' index = %r" % score_b
            print "Normal, normal Ninny = %r" % score_c
            print "Issues? Nothing prozac can't fix = %r" % score_d
            print "Get your ears checked and/or Narcasism = %r" % score_e
            print "OCD or Friggen nuts =  %r" % score_f
            print "Indecisive and/or Friggen Nuts = %r" % score_g
            print "Bat shit. = %r" % score_h
            print "\n"
            print "Please use keys a-->g"
            break
            x = 13
    if 'exit' in answer:
        sys.exit()

       
personality_quiz()


Khan Academy code.

Someone on Khan Academy said I could make a repeating function.
So now i must try.



//CAUSE I LOVE RAINBOWS, they are pretty. No real other reason.

var RAINBOW = (random(0,175 ), random(0, 75), random(0, 175));
strokeWeight(2);
stroke(RAINBOW);

//make lines!

var draw = function() {
   
     background(223, 225, 237);
    //trying to make a line repeat without typing code for each line
    //I made a list for colors, but the OH NOES!!! guy keeps prompting me to use
    //the blue() command, so apparently you can't use the word blue!!!
    //i is for the plottinglist... or repeat function I plan on making
    //empty plotting list, so you can make it whatever length you want
    
     var plottinglist = [];
     plottinglist.length = 40; //so here you could ask for user input.
    for (var i = 0; i < plottinglist.length; i+=1) {
        var x1 = 0;
        var x2 = 400;
        var y1 = 10;  
        var y2 = 10;
        var change = i * 10;
        line(x1, y1 + change, x2, y2 + change);}
     for (var i = 0; i < plottinglist.length; i+=1) {
        var change = i * 10; 
        var x = 10;
        var y = 10;
        var xa = 10;
        var ya = 400;
        line(x + change, y, xa + change, ya);}
       
    
    
       
   
};

Thursday, February 20, 2014

Same Pygame code... cleaner.

Took me a bit to figure out how to make it work in a function, instead of in the 'while' loop.
  Got er' though.
  And you'd think getting the text to stay on top of the background would be simple....  but NO! had to play with it to figure it out.  See octothorps.
   
  #one of these is my culprit ... If I take out lines   4, 3, 2, 1 individually
  #the game runs black window,  after I took them out and put them back in
 #my text disappeared again....  It has to be here somewhere.
 # I like to save a working copy of the code before I mess with it. Just so I can
 # refer to old code, and in case I completely mess it up.
# Apparently the text has to be 'blit' ((load image to screen)) before the background
# Seems really out of order to me.  Gonna have to keep researching.  wanna code.

import pygame
import random
import sys

from pygame.locals import*

#trying to figure out sprite
width = 100
height = 100
size = [40, 40]
   
   
   
   
#the part that works
def main():   
    pygame.init()
   
    SCREEN = pygame.display.set_mode((800,800))
    pygame.display.set_caption('Nellie wants to be a Geek!')

    x = random.randint(0, 255)
    y = random.randint(10, 245)
    z = random.randint(15, 200)
    RAINBOW = (x, y, z)
    x1 = random.randint(0, 255)
    y1 = random.randint(10, 245)
    z1 = random.randint(15, 200)
    RAINBOW1 = (x1, y1, z1)
    BLACK = (0, 0, 0)
    WHITE = (255, 255, 255)
    PURPLE = (255, 0, 220)
    BLUE = (74, 74, 250)

   
    BACKGROUND = pygame.Surface(SCREEN.get_size())
    BACKGROUND = BACKGROUND.convert()
    BACKGROUND.fill((100,75,200))
   
   

    pygame.draw.rect(BACKGROUND, BLUE, (0, 0, 800, 675))
    pygame.draw.rect(BACKGROUND, BLACK, (0, 0, 800, 75))
    pygame.draw.line(BACKGROUND, WHITE, (0, 675), (800, 675), 10)
   
    (mouseX, mouseY) = pygame.mouse.get_pos()
    pygame.draw.circle(BACKGROUND, (RAINBOW1), (mouseX, mouseY), 20, 20)
    x1 = random.randint(0, 255)
    y1 = random.randint(10, 245)
    z1 = random.randint(15, 200)
    RAINBOW1 = (x1, y1, z1)
    font = pygame.font.Font(None, 49)
    text = font.render("Pooping Unicorn! Clicky clicky!", False, RAINBOW1)
    textPos = text.get_rect()
    textPos.centerx = BACKGROUND.get_rect().centerx

    #Sprite kinda....
    #speed = [2, 2]
    #ball = pygame.sprite.Sprite()
    #ball.image = pygame.image.load("100_0643.jpg").convert()
    #ball.rect = ball.image.get_rect()
    #ball.rect.topleft = [75,300]
    #screen.blit(ball.image, ball.rect)
   
   
    pygame.display.update()
    #screen.blit(ball.image, ball.rect) #1
    BACKGROUND.blit(text, textPos)    #2
    SCREEN.blit(BACKGROUND, (0,0))     #3  
    pygame.display.flip() #4

    while 1:   
       
        for event in pygame.event.get():
            if event.type == QUIT:
                pygame.quit()
                sys.exit()   
            if event.type == MOUSEBUTTONDOWN :
                main()
               
                BACKGROUND.blit(text, textPos)
       

if __name__ == '__main__': main()

   

Saturday, February 8, 2014

I'm thinking about editting my blog so that all that is left are short stories, and ideas.  
The personal stuff, well it is nice to be able to share, even if no one's listening,  but maybe it's better to just keep it to story's, art and stuff like that.  
Haven't decided yet.   Cause honestly the blog is really just an ego booster, and storage device for the stuff in my head that would otherwise leak out and become fodder to the bandits of time. 

Wish everything had an easy button.   Why can't I just see what I want to do... and do it?  It's like everything is some big blurr, and I'm meant to figure it out.
There's a big blurry red thing over there that might be nice to reach for,  but I don't know if it will burn me.
There's a big furry thing over there, that always feels nice to touch, but someday it might grow teeth and bite me.
There's that wierd annoying noise in the corner that never goes away, and I want to investigate getting rid of it, but I don't know if it will turn into an alien monster and attack. 
Outside my house are people... millions, billions, too many to count or comprehend, and each of them is a mystery.  Monster, or normal, Scary or friendly, Hateful or full of love.... I don't know.  They are all a blurry and I don't want to risk it.
Well, that's how I feel tonight anyways.  Let's make an app for it.   An app for anti-gravity,  for traveling to the moon,  for teleportation and invisibility,  or identifying that wierd bowl of horridness in the fridge. 
An app for curing the panic, sad, worrysome parts,  or to boost the happy, wonderful good parts. 
Like the easy button. 
Let's make an app, because my brain just can't compute it.

Off I go. 
I'll decide another day. 

Wednesday, February 5, 2014

The internet is teaching me PYGAME!

import pygame
import random

from pygame.locals import*


def main():   
    pygame.init()
   

   
    (mouseX, mouseY) = pygame.mouse.get_pos()
       
    SCREEN = pygame.display.set_mode((800,800))
    pygame.display.set_caption('Nellie wants to be a Geek!')

    BACKGROUND = pygame.Surface(SCREEN.get_size())
    BACKGROUND = BACKGROUND.convert()
    BACKGROUND.fill((100,100,100))

    x = random.randint(0, 255)
    y = random.randint(10, 245)
    z = random.randint(15, 200)
    RAINBOW = (x, y, z)
    x1 = random.randint(0, 255)
    y1 = random.randint(10, 245)
    z1 = random.randint(15, 200)
    RAINBOW1 = (x1, y1, z1)
    BLACK = (0, 0, 0)
    WHITE = (255, 255, 255)
    PURPLE = (255, 0, 220)
    BLUE = (50, 50, 250)
   
    font = pygame.font.Font(None, 49)
    text = font.render("Pooping Unicorn! Clicky clicky!", False, RAINBOW)
    textPos = text.get_rect()
    textPos.centerx = BACKGROUND.get_rect().centerx
    BACKGROUND.blit(text, textPos)
   
   
   
    SCREEN.blit(BACKGROUND, (0,0))
    pygame.display.flip()


    while 1:   
       
        for event in pygame.event.get():
            if event.type == MOUSEBUTTONDOWN :
                (mouseX, mouseY) = pygame.mouse.get_pos()
                pygame.draw.circle(BACKGROUND, (RAINBOW1), (mouseX, mouseY) , 20, 20)
                x1 = random.randint(0, 255)
                y1 = random.randint(10, 245)
                z1 = random.randint(15, 200)
                RAINBOW1 = (x1, y1, z1)
            if event.type == QUIT:
                return   
        SCREEN.blit(BACKGROUND, (0,0))
        pygame.display.flip()
       

if __name__ == '__main__': main()