Chasing the food(first actual game I've made)

This is the place to post any code that you want to share with the community. Only completed scripts should be posted here.

Chasing the food(first actual game I've made)

Postby Hissing Cockroach » Fri Oct 25, 2013 1:05 am

This is my first thing you could actually call a game!
It's still in progress, so if anyone has any suggestions,
I might need some. Anyone is welcome to add on to
this!

Code: Select all
import pygame, sys
import time
import os

pygame.init()

def image_from_url(url):
    try:
        from urllib2 import urlopen
        from cStringIO import StringIO as inout
    except ImportError:
        from urllib.request import urlopen
        from io import BytesIO as inout
    myurl = urlopen(url)
    return inout(myurl.read())
   
url = 'http://i1315.photobucket.com/albums/t600/11roadkills/9705abeb-8eab-4379-afe2-b8355bcd6b4f_zps86fb3a66.jpg?t=1382655213'
url2 = 'http://i1315.photobucket.com/albums/t600/11roadkills/pic_zps4fceb2fb.png'
DISPLAYSURF = pygame.display.set_mode((900,700),0,32)
pygame.display.set_caption('Freeroam')



WHITE = (255,255,255)
BLACK = (0,0,0)
RED = (255,0,0)
YELLOW = (255,255,0)
BROWN = (139,69,19)
BROWN2 = (218,165,32)
level = 2
img = pygame.image.load(image_from_url(url))
logo = pygame.image.load(image_from_url(url2))
myfont = pygame.font.SysFont("Lucida Console", 30)
myfont2 = pygame.font.SysFont("Lucida Console", 100)
label = myfont.render("Press P to play", 1 , BLACK)
label2 = myfont2.render("GAME OVER", 1, RED)
x = 723
y = 298
l = False
p = False
while True:
    DISPLAYSURF.fill(WHITE)
    key = pygame.key.get_pressed()
    if key[pygame.K_p]:
        p = True
        l = True
    if l == True and key[pygame.K_UP]:
        y -= level
    if l == True and key[pygame.K_DOWN]:
        y += level
       

       

    DISPLAYSURF.blit(img, (x,y))

    if p == False:
        DISPLAYSURF.fill(RED)
        DISPLAYSURF.blit(logo, (100,100))
        DISPLAYSURF.blit(label, (100,100))
   
    if x <= 91 and y <= 92:
        level += 1
        x = 723
        y = 298
    if l == True:
        x -= level

    if x >= 733:
        x = 732
    if x <= -25 or y <= -30:
        l = False
        DISPLAYSURF.blit(label2, (200,350))
       
    if y >= 595:
        l = False
        DISPLAYSURF.blit(label2, (200,350))
 
    print x
    print y
    print level
    os.system('cls')

    if not level%2==0:
        pygame.draw.circle(DISPLAYSURF, BROWN2, (1, 1), 170, 170)
        pygame.draw.circle(DISPLAYSURF, BROWN, (10,100), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (100,10), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (20,50), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (150,50), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (50,150), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (80,100), 10,10)

    if level%2==0:
        pygame.draw.circle(DISPLAYSURF, BROWN2, (1, 700), 170, 170)
        pygame.draw.circle(DISPLAYSURF, BROWN, (10,650), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (100,700), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (20,670), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (150,660), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (50,610), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (80,601), 10,10)
        if x <= 110 and y >= -29:
            level += 1
            x = 723
            y = 298
       
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()


    pygame.display.update()
User avatar
Hissing Cockroach
 
Posts: 108
Joined: Sat Sep 14, 2013 2:35 pm
Location: Earth

Re: Chasing the food(first actual game I've made)

Postby dboxall123 » Fri Oct 25, 2013 5:30 pm

so if anyone has any suggestions, I might need some.

Learn to use classes and functions. Also, instead of using
Code: Select all
if l == True:

you can just use
Code: Select all
if l:
dboxall123
 
Posts: 121
Joined: Fri Jul 12, 2013 5:28 pm

Re: Chasing the food(first actual game I've made)

Postby Kebap » Sat Oct 26, 2013 10:43 am

dboxall123 wrote:you can just use
Code: Select all
if l:

Never use the characters 'l' (lowercase letter el), 'O' (uppercase letter oh), or 'I' (uppercase letter eye) as single character variable names.

In some fonts, these characters are indistinguishable from the numerals one and zero. When tempted to use 'l', use 'L' instead.

http://www.python.org/dev/peps/pep-0008/#names-to-avoid
Learn: How To Ask Questions The Smart Way
Join the #python-forum IRC channel on irc.freenode.net and chat with uns directly!
Kebap
 
Posts: 403
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe

Re: Chasing the food(first actual game I've made)

Postby Mekire » Sat Oct 26, 2013 11:14 am

Honestly we shouldn't be using one letter variables in the first place here. One letter variables should really be reserved for counters in loops. Occasionally x,y coordinates; but really it shouldn't be encouraged.

-Mek
User avatar
Mekire
 
Posts: 1131
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan

Re: Chasing the food(first actual game I've made)

Postby metulburr » Sat Oct 26, 2013 11:15 am

Honestly we shouldn't be using one letter variables in the first place here. One letter variables should really be reserved for counters in loops. Occasionally x,y coordinates; but really it shouldn't be encouraged.

-Mek


+1

I already gave my suggestions
still no functions/classes and the use of magic numbers

Before proceeding to your next game or considering yourself knowledgeable in the use of python/pygame/2d gaming, i would suggest to tighty up this code to where none of us say there is much we can do. Convert this to use functions. Get rid of the magic numbers. Then switch it over to use classes.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1562
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Chasing the food(first actual game I've made)

Postby Hissing Cockroach » Sun Oct 27, 2013 3:49 pm

metulburr wrote:still no functions/classes and the use of magic numbers


I'm not meaning to be rude, but
like I said, It's still in progress.
Anyway, thank you all for sharing you'r opinion and advice!
User avatar
Hissing Cockroach
 
Posts: 108
Joined: Sat Sep 14, 2013 2:35 pm
Location: Earth

Re: Chasing the food(first actual game I've made)

Postby metulburr » Sun Oct 27, 2013 8:12 pm

I'm not meaning to be rude, but
like I said, It's still in progress.!

It would take less than 3 minutes to convert it to use functions/classes. The only reason i can think of your reasoning to not be converting it, is that you have yet to learn it. Which is fine. Everyone starts somewhere. I am not sure though why you would proceed in 2d gaming without knowing basic OOP? Trying to proceed in gaming without OOP normally ends in unmaintainable code. To you, the coder, and to us the helpers, both have to deal with it at that point. It really is worth the effort in learning if you are unaware or uncomfortable in using it.
New Users, Read This
OS Ubuntu 14.04, Arch Linux, Gentoo, Windows 7/8
https://github.com/metulburr
steam
User avatar
metulburr
 
Posts: 1562
Joined: Thu Feb 07, 2013 4:47 pm
Location: Elmira, NY

Re: Chasing the food(first actual game I've made)

Postby Mekire » Mon Oct 28, 2013 3:08 am

If you are willing to work to improve this, how about we take it in small steps? Try replacing the coordinates of your bug and food with a pygame.Rect and give meaningful variable names to p and l. Also I'm sure you have noticed the patterns on your circles. If you draw filled circles in order of biggest to smallest, you can avoid this issue (although this is SDLs fault; not yours).

-Mek
User avatar
Mekire
 
Posts: 1131
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan

Re: Chasing the food(first actual game I've made)

Postby Hissing Cockroach » Mon Oct 28, 2013 3:49 am

I modified my code:

Code: Select all
import pygame, sys
import time
import os

pygame.init()

def image_from_url(url):
    try:
        from urllib2 import urlopen
        from cStringIO import StringIO as inout
    except ImportError:
        from urllib.request import urlopen
        from io import BytesIO as inout
    myurl = urlopen(url)
    return inout(myurl.read())
   
url = 'http://i1315.photobucket.com/albums/t600/11roadkills/9705abeb-8eab-4379-afe2-b8355bcd6b4f_zps86fb3a66.jpg?t=1382655213'
url2 = 'http://i1315.photobucket.com/albums/t600/11roadkills/pic_zps4fceb2fb.png'
DISPLAYSURF = pygame.display.set_mode((900,700),0,32)
DISPLAY_RECT = DISPLAYSURF.get_rect()
pygame.display.set_caption('Freeroam')



WHITE = (255,255,255)
BLACK = (0,0,0)
RED = (255,0,0)
YELLOW = (255,255,0)
BROWN = (139,69,19)
BROWN2 = (218,165,32)
level = 2
img = pygame.image.load(image_from_url(url))
logo = pygame.image.load(image_from_url(url2))
myfont = pygame.font.SysFont("Lucida Console", 30)
myfont2 = pygame.font.SysFont("Lucida Console", 100)
myfont4 = pygame.font.SysFont("Comic Sans MS", 60)
label = myfont.render("Press P to play", 1 , BLACK)
label2 = myfont2.render("GAME OVER", 1, RED)
label5 = myfont4.render("Chasing The Food", 1, YELLOW)

rect = img.get_rect(topleft=(80,100))
l = False
p = False
while True:
    DISPLAYSURF.fill(WHITE)
    key = pygame.key.get_pressed()
    if key[pygame.K_p]:
        p = True
        l = True
    if l and key[pygame.K_UP]:
        rect.y -= level
    if l and key[pygame.K_DOWN]:
        rect.y += level
    rect.clamp_ip(DISPLAY_RECT)
       

       

    DISPLAYSURF.blit(img,rect)

    if p == False:
        DISPLAYSURF.fill(RED)
        DISPLAYSURF.blit(logo, (100,100))
        DISPLAYSURF.blit(label, (100,500))
        DISPLAYSURF.blit(label5, (150,100))

       
    if rect.x <= 91 and rect.y <= 92:
        level += 1
        rect.x = 723
        rect.y = 298
    if l == True:
        rect.x -= level
    if img.rect[1] < 0:
        DISPLAYSURF.blit(label2, (200,350))
 

    print "SCORE:"
    print level
    print
    print "INSTRUCTIONS:"
    print "Use the up and down arrow keys to"
    print "Guide the roach to the food, but don't"
    print "touch the paremater! It will mean sudden death"

    os.system('cls')

    if not level%2==0:
        pygame.draw.circle(DISPLAYSURF, BROWN2, (1, 1), 170, 170)
        pygame.draw.circle(DISPLAYSURF, BROWN, (10,100), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (100,10), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (20,50), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (150,50), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (50,150), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (80,100), 10,10)

    if level%2==0:
        pygame.draw.circle(DISPLAYSURF, BROWN2, (1, 700), 170, 170)
        pygame.draw.circle(DISPLAYSURF, BROWN, (10,650), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (100,700), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (20,670), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (150,660), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (50,610), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (80,601), 10,10)
        if x <= 141 and y >= 476:
            level += 1
            x = 723
            y = 298

           
       
       

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


    pygame.display.update()


But it brings up this error:

Code: Select all
Traceback (most recent call last):
  File "C:\Users\Family\Desktop\pys\Get the food.py", line 74, in <module>
    if img.rect[1] < 0:
AttributeError: 'pygame.Surface' object has no attribute 'rect'


:? ?!?!?!?!?!?
I really don't get this error.
Last edited by Hissing Cockroach on Mon Oct 28, 2013 4:04 am, edited 1 time in total.
User avatar
Hissing Cockroach
 
Posts: 108
Joined: Sat Sep 14, 2013 2:35 pm
Location: Earth

Re: Chasing the food(first actual game I've made)

Postby Mekire » Mon Oct 28, 2013 3:57 am

This is where a little knowledge of classes will help.

Your image is an instance of the class Surface. Surface and Rect are different.
You can however make a Rect from a surface like this:
Code: Select all
my_rect = image.get_rect()

-Mek
User avatar
Mekire
 
Posts: 1131
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan

Re: Chasing the food(first actual game I've made)

Postby Hissing Cockroach » Mon Oct 28, 2013 4:17 am

Thanks! I really appreciate that,
but quick question: how do I get

Code: Select all
    if my_rect[1] < 0:
        DISPLAYSURF.blit(label2, (200,350))


to work?
User avatar
Hissing Cockroach
 
Posts: 108
Joined: Sat Sep 14, 2013 2:35 pm
Location: Earth

Re: Chasing the food(first actual game I've made)

Postby Mekire » Mon Oct 28, 2013 5:07 am

Well,
rect[0] is the same as rect.x and rect[1] is the same as rect.y

As earlier in your program you are clamping the rect right after updating the y axis; your line would never run.

I believe what you want to write is:
Code: Select all
if my_rect.x < 0:
    DISPLAYSURF.blit(label2, (200,350))

I'm afraid I don't have access to an interpreter at the moment so I can't really test your code. Basically you want to create a pygame.Rect for your bug and then everywhere you have x, or y; replace it with bug_rect.x and bug_rect.y. That will at least get us moving in the right direction.

-Mek
User avatar
Mekire
 
Posts: 1131
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan

Re: Chasing the food(first actual game I've made)

Postby Hissing Cockroach » Mon Oct 28, 2013 5:08 pm

This line of code still won't run,
but I can't figure out why. Glitch maybe?
User avatar
Hissing Cockroach
 
Posts: 108
Joined: Sat Sep 14, 2013 2:35 pm
Location: Earth

Re: Chasing the food(first actual game I've made)

Postby Mekire » Mon Oct 28, 2013 10:27 pm

Very unlikely. Paste your current code.

-Mek
User avatar
Mekire
 
Posts: 1131
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan

Re: Chasing the food(first actual game I've made)

Postby Hissing Cockroach » Mon Oct 28, 2013 11:08 pm

Here it is:

Code: Select all
import pygame, sys
import time
import os

pygame.init()

def image_from_url(url):
    try:
        from urllib2 import urlopen
        from cStringIO import StringIO as inout
    except ImportError:
        from urllib.request import urlopen
        from io import BytesIO as inout
    myurl = urlopen(url)
    return inout(myurl.read())
   
url = 'http://i1315.photobucket.com/albums/t600/11roadkills/9705abeb-8eab-4379-afe2-b8355bcd6b4f_zps86fb3a66.jpg?t=1382655213'
url2 = 'http://i1315.photobucket.com/albums/t600/11roadkills/pic_zps4fceb2fb.png'
DISPLAYSURF = pygame.display.set_mode((900,700),0,32)
DISPLAY_RECT = DISPLAYSURF.get_rect()
pygame.display.set_caption('Freeroam')



WHITE = (255,255,255)
BLACK = (0,0,0)
RED = (255,0,0)
YELLOW = (255,255,0)
BROWN = (139,69,19)
BROWN2 = (218,165,32)
level = 2
img = pygame.image.load(image_from_url(url))
logo = pygame.image.load(image_from_url(url2))
myfont = pygame.font.SysFont("Lucida Console", 30)
myfont2 = pygame.font.SysFont("Lucida Console", 100)
myfont4 = pygame.font.SysFont("Comic Sans MS", 60)
label = myfont.render("Press P to play", 1 , BLACK)
label2 = myfont2.render("GAME OVER", 1, RED)
label5 = myfont4.render("Chasing The Food", 1, YELLOW)

rect = img.get_rect(topleft=(723,298))
my_rect = img.get_rect()
l = False
p = False
while True:
    DISPLAYSURF.fill(WHITE)
    key = pygame.key.get_pressed()

#This is the if block I'm having trouble with:
    if my_rect.x < 0:
          l == False
         DISPLAYSURF.blit(label2, (200,350))[/b]

    if key[pygame.K_p]:
        p = True
        l = True
    if l and key[pygame.K_UP]:
        rect.y -= level
    if l and key[pygame.K_DOWN]:
        rect.y += level
    rect.clamp_ip(DISPLAY_RECT)
       

    DISPLAYSURF.blit(img,rect)

    if p == False:
        DISPLAYSURF.fill(RED)
        DISPLAYSURF.blit(logo, (100,100))
        DISPLAYSURF.blit(label, (100,500))
        DISPLAYSURF.blit(label5, (150,100))

       

    if l == True:
        rect.x -= level
       
 

    print "SCORE:"
    print level
    print "INSTRUCTIONS:"
    print "Use the up and down arrow keys to"
    print "Guide the bug/thing to the food, but don't"
    print "touch the paremater! It will mean sudden death."

    os.system('cls')

    if not level%2==0:
        pygame.draw.circle(DISPLAYSURF, BROWN2, (1, 1), 170, 170)
        pygame.draw.circle(DISPLAYSURF, BROWN, (10,100), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (100,10), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (20,50), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (150,50), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (50,150), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (80,100), 10,10)
        if rect.x <= 91 and rect.y <= 92:
            level += 1
            rect.x = 723
            rect.y = 298

    if level%2==0:
        pygame.draw.circle(DISPLAYSURF, BROWN2, (1, 700), 170, 170)
        pygame.draw.circle(DISPLAYSURF, BROWN, (10,650), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (100,700), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (20,670), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (150,660), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (50,610), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (80,601), 10,10)
        if rect.x <= 141 and rect.y >= 476:
            level += 1
            rect.x = 723
            rect.y = 298

           
       
       

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


    pygame.display.update()
User avatar
Hissing Cockroach
 
Posts: 108
Joined: Sat Sep 14, 2013 2:35 pm
Location: Earth

Re: Chasing the food(first actual game I've made)

Postby Mekire » Tue Oct 29, 2013 8:55 am

Here it is using a rect for the bug:
Code: Select all
import os
import sys
import pygame


def image_from_url(url):
    try:
        from urllib2 import urlopen
        from cStringIO import StringIO as inout
    except ImportError:
        from urllib.request import urlopen
        from io import BytesIO as inout
    myurl = urlopen(url)
    return inout(myurl.read())


BUG_URL = ('http://i1315.photobucket.com/albums/t600/11roadkills/'
           '9705abeb-8eab-4379-afe2-b8355bcd6b4f_zps86fb3a66.jpg?t=1382655213')
LOGO_URL = ('http://i1315.photobucket.com/albums/t600/11roadkills/'
            'pic_zps4fceb2fb.png')


WHITE = (255,255,255)
BLACK = (0,0,0)
RED = (255,0,0)
YELLOW = (255,255,0)
BROWN = (139,69,19)
BROWN2 = (218,165,32)

pygame.init()
DISPLAYSURF = pygame.display.set_mode((900,700),0,32)
pygame.display.set_caption('Freeroam')
clock = pygame.time.Clock()

level = 2
bug_image = pygame.image.load(image_from_url(BUG_URL))
logo = pygame.image.load(image_from_url(LOGO_URL))
myfont = pygame.font.SysFont("Lucida Console", 30)
myfont2 = pygame.font.SysFont("Lucida Console", 100)
label = myfont.render("Press P to play", 1 , BLACK)
label2 = myfont2.render("GAME OVER", 1, RED)

bug_rect = bug_image.get_rect(topleft=(723,298))

l = False
p = False
while True:
    DISPLAYSURF.fill(WHITE)
    key = pygame.key.get_pressed()
    if key[pygame.K_p]:
        p = True
        l = True
    if l == True and key[pygame.K_UP]:
        bug_rect.y -= level
    if l == True and key[pygame.K_DOWN]:
        bug_rect.y += level

    DISPLAYSURF.blit(bug_image, bug_rect)

    if p == False:
        DISPLAYSURF.fill(RED)
        DISPLAYSURF.blit(logo, (100,100))
        DISPLAYSURF.blit(label, (100,100))

    if bug_rect.x <= 91 and bug_rect.y <= 92:
        level += 1
        bug_rect.topleft = (723,298)

    if l == True:
        bug_rect.x -= level

    if bug_rect.x >= 733:
        bug_rect.x = 732
    if bug_rect.x <= -25 or bug_rect.y <= -30:
        l = False
        DISPLAYSURF.blit(label2, (200,350))

    if bug_rect.y >= 595:
        l = False
        DISPLAYSURF.blit(label2, (200,350))

    if not level%2==0:
        pygame.draw.circle(DISPLAYSURF, BROWN2, (1, 1), 170, 170)
        pygame.draw.circle(DISPLAYSURF, BROWN, (10,100), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (100,10), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (20,50), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (150,50), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (50,150), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (80,100), 10,10)

    if level%2==0:
        pygame.draw.circle(DISPLAYSURF, BROWN2, (1, 700), 170, 170)
        pygame.draw.circle(DISPLAYSURF, BROWN, (10,650), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (100,700), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (20,670), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (150,660), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (50,610), 10,10)
        pygame.draw.circle(DISPLAYSURF, BROWN, (80,601), 10,10)
        if bug_rect.x <= 110 and bug_rect.y >= -29:
            level += 1
            bug_rect.topleft = (723, 298)

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

    pygame.display.update()
    clock.tick(60)

Make sure you understand what is going on completely before continuing.
The next small thing you need to do is rename your p and l variables.
After you have done that I want you to try tackling writing a function.

Write a function to create the image for your food, so that we don't have to redraw it every time.
This will involve creating a surface within the function and then drawing to that instead of to your display surface.

-Mek
User avatar
Mekire
 
Posts: 1131
Joined: Thu Feb 07, 2013 11:33 pm
Location: Asakusa, Japan


Return to Completed Scripts

Who is online

Users browsing this forum: No registered users and 0 guests