|
| 23 Aug 2014 04:08 AM |
enter the following code into python with pygame if you have it
# Square Game # # Light up the quarters with 1, 2, 3, 4. Has a rudimentary level of gameplay. # # --------------------------------
import pygame, sys, time, random from pygame.locals import *
pygame.init()
# set-up
BLACK = (0, 0, 0) GREY = (128, 128, 128) YELLOW = (255, 255, 0)
colour = GREY
width = 4 x = 300 y = 250 radius = 200
piece1 = False piece2 = False piece3 = False piece4 = False
# pre-code
SURFACE = pygame.display.set_mode((600, 500)) SURFACE.fill(BLACK)
pygame.display.set_caption("Press 1, 2, 3, 4")
FONT = pygame.font.Font(None, 60)
# loop
while True: for event in pygame.event.get(): if event.type == QUIT: sys.exit() elif event.type == KEYUP: if event.key == pygame.K_ESCAPE: sys.exit() elif event.key == pygame.K_1: piece1 = True elif event.key == pygame.K_2: piece2 = True elif event.key == pygame.K_3: piece3 = True elif event.key == pygame.K_4: piece4 = True
SURFACE.fill(BLACK)
# code
# draw the numbers NUM1 = FONT.render("1", True, colour) SURFACE.blit(NUM1, (218, 160)) NUM2 = FONT.render("2", True, colour) SURFACE.blit(NUM2, (370, 160)) NUM3 = FONT.render("3", True, colour) SURFACE.blit(NUM3, (370, 310)) NUM4 = FONT.render("4", True, colour) SURFACE.blit(NUM4, (218, 310))
# should the pieces be drawn? if piece1: pygame.draw.rect(SURFACE, colour, (x-150, y-150, 150, 150), width) if piece2: pygame.draw.rect(SURFACE, colour, (x, y-150, 150, 150), width) if piece3: pygame.draw.rect(SURFACE, colour, (x, y, 150, 150), width) if piece4: pygame.draw.rect(SURFACE, colour, (x-150, y, 150, 150), width)
if piece1 and piece2 and piece3 and piece4: colour = YELLOW
pygame.display.update() |
|
|
| Report Abuse |
|
|
eprent
|
  |
| Joined: 17 Oct 2013 |
| Total Posts: 15007 |
|
|
| 23 Aug 2014 04:09 AM |
Cool! I don't know Python haha I code Lua, VB, C#, basic PHP, and all that other web stuff that I don't consider languages (CSS,HTML,etc) |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:09 AM |
| how long have you been learning that |
|
|
| Report Abuse |
|
|
eprent
|
  |
| Joined: 17 Oct 2013 |
| Total Posts: 15007 |
|
|
| 23 Aug 2014 04:10 AM |
What do you mean? PHP? I have been teaching myself PHP for the last month |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:11 AM |
| no, all of the languages you learned |
|
|
| Report Abuse |
|
|
eprent
|
  |
| Joined: 17 Oct 2013 |
| Total Posts: 15007 |
|
|
| 23 Aug 2014 04:12 AM |
I learned Lua in a monthish, a few months to learn all the syntax I learned VB in a monthish as well I took 3 months for C# and CSS/HTML/etc took me a few days |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:12 AM |
it's actually really simple
press numbers 1 2 3 and 4 to make quarters of a big square appear on a screen
when you get all of them it turns yellow or you can add a colour and edit the 'colour' variable |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:14 AM |
| also i'm 12 years old and learning pygame get on my level |
|
|
| Report Abuse |
|
|
eprent
|
  |
| Joined: 17 Oct 2013 |
| Total Posts: 15007 |
|
| |
|
|
| 23 Aug 2014 04:15 AM |
are you the only programmer on OT
besides me |
|
|
| Report Abuse |
|
|
eprent
|
  |
| Joined: 17 Oct 2013 |
| Total Posts: 15007 |
|
|
| 23 Aug 2014 04:16 AM |
Nah, I think his name is ax34 or something He programs as well |
|
|
| Report Abuse |
|
|
| |
|
|
| 23 Aug 2014 04:18 AM |
| He pretends he knows C# but when you ask him for a simple script he can't make it. |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:19 AM |
@addiction3
"enter the following code into python with pygame if you have it"
yes it's python
also programming is hard
programming is hard and nobody understands |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:21 AM |
i can make games on clickteam fusion
im hella good at it too |
|
|
| Report Abuse |
|
|
ezt12
|
  |
| Joined: 09 Jul 2014 |
| Total Posts: 1531 |
|
|
| 23 Aug 2014 04:21 AM |
| thig, programming isn't hard if you understand the theory. also, just knowing python isn't that impressive at 12. when i was 12 i knew html (not a language), css, javascript, php, java, lua and unity script. |
|
|
| Report Abuse |
|
|
eprent
|
  |
| Joined: 17 Oct 2013 |
| Total Posts: 15007 |
|
|
| 23 Aug 2014 04:22 AM |
@Addiction3 Would you shut up? Just because you're a little ass and flaming me on every fricken thread does not mean I don't know C#
Pay attention to the one thread, he will keep posting because it's automated
|
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:22 AM |
@brandoncult
looks like a thing like unity or gamemaker |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:23 AM |
@ezt2
do you people work all day and night or something
i usually drag it out, doing one or two or three scripts from this programming book in front of me a day |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:24 AM |
"Would you shut up? Just because you're a little ass and flaming me on every fricken thread does not mean I don't know C#"
You sure as hell don't know how PHP works.
"Pay attention to the one thread, he will keep posting because it's automated"
Why don't you make it post every 30 seconds then well see if it's real. |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:24 AM |
"when i was 12 i knew html (not a language), css, javascript, php, java, lua and unity script"
WHAT KIND OF KID HAS THE INTEREST OR PATIENCE FOR THIS |
|
|
| Report Abuse |
|
|
ezt12
|
  |
| Joined: 09 Jul 2014 |
| Total Posts: 1531 |
|
|
| 23 Aug 2014 04:24 AM |
| thig: yes, i suppose. i've been learning since i was 9. i started off with lua and then moved out to html and css, then javascript, then php, then java, then unity script |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:25 AM |
@thig
Yea it's like gameaker but waaaaay simpler |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:29 AM |
| i will take ezt's approach and write more scripts |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2014 04:32 AM |
| i think he played roblox at 9 and learned about scripting, then got interested in other languages (and non languages) |
|
|
| Report Abuse |
|
|