+ 2
Which language should I use to program small games?
9 Réponses
+ 2
Thank you sooooo much for your help, now I can continue learning python (because it really didn't teach me much and it was hard)
+ 4
look up a tutorial on pygame, I can send you some examples too if you would like
+ 3
@Jason Wade
Heres as example of a basic game using pygame. You'll have to install pygame first to be able to use it, so this won't run in the basic solo learn compiler.
# Import PYGAME
import pygame
import random
# INITialize pygame
pygame.init()
# Open a WINDOW of size [500, 300]
window = pygame.display.set_mode([500, 300])
# --- Variables --- #
# Create variable caught with value False
caught = False
# Create variable done with value False
done = False
r = random.randint(50, 255)
# Define RECT shape called ball with starting point
# 225, 0, and width and height 50
ball = pygame.Rect(r, 0, 50, 50)
# Define RECT shape called player with starting point
# 200, 280, width 100, and height 20
# ---> TEST AFTER THIS LINE <--- #
player = pygame.Rect(r - 20, 280, 100, 20)
#### ---- MAIN LOOP ---- ####
# While not caught and not done
while not caught and not done:
for event in pygame.event.get():
if event.type == pygame.QUIT:
done = True
# --- Mouse Clicks --- #
# ELIF event.type is MOUSEBUTTONDOWN
elif event.type == pygame.MOUSEBUTTONDOWN:
distance = player.y - ball.y
# If the distance is between 0 and 50
if distance <= 50 and distance >= 0:
caught = True
# Set caught to True
# ---> TEST AFTER THIS LINE <--- #
# --- Move Ball --- #
# Increment ball.y by 5
ball.y += 10
# If ball.y is more than 300
if ball.y > 300:
# Set ball.y to 0
# ---> TEST AFTER THIS LINE <--- #
ball.y = 0
# --- Draw --- #
# FILL the window with WHITE
window.fill((0, 0, 0))
# Draw the player RECT with a color of your choice
pygame.draw.rect(window, (255, 0, 0), player)
# Draw the ball ELLIPSE with a color of your choice
pygame.draw.ellipse(window, (0, 255, 0), ball)
pygame.display.flip()
pygame.time.wait(10)
+ 2
I tried python, but I don't see how I can make a game with that :(
+ 2
Theads for C++ game developement
https://www.sololearn.com/discuss/488976/?ref=app
https://www.sololearn.com/discuss/498964/?ref=app
+ 2
I forgot to mention a couple of other things:
look into Lua (programming language). The syntax is fairly simple and somewhat easy to pick up. Also, check out Löve. Löve is a 2D (and 3D) game engine which uses Lua as its programming language (very nice).
I checked it out a few months ago and found it quite fun using Löve and Lua. there are quite a bit of tutorials on YouTube.
+ 1
+ 1
@Gabe Vogel please
+ 1
If you want any other examples I have ~50 more that I can send you, but it will have to be through email (vogelgabej@gmail.coml as they are over the max characters that solo-learn allows in a comment.