It lives!!!
Finally. Something that moves on the screen.
# ################### #
# #
# Matthias Wheelhouse #
# Advent #
# #
# ################### #
import pygame, sys
from pygame.locals import *
pygame.init()
# set size and name
size = (800, 500)
screen = pygame.display.set_mode((size))
pygame.display.set_caption("Advent")
# screen refresh
clock = pygame.time.Clock()
## setup of the main program loop and it's variables ##
done = False
black = ( 0, 0, 0)
background = pygame.image.load('bg.png')
platform = pygame.image.load('platform.png')
player = pygame.image.load('player.png')
playerx = 100
playery = 423
# --- Main Program Loop --- #
while done == False:
for event in pygame.event.get(): # user did something
if event.type == pygame.QUIT: # if user clicked close
done = True # flag done to exit this loop
# all game logic should go below this comment
if event.type == KEYDOWN:
if event.key == K_RIGHT:
playerx += 5
if event.key == K_LEFT:
playerx -= 5
### insert rest of controls here ###
if event.type == KEYUP:
playerx
# all code to draw should go below this comment
screen.fill(black)
screen.blit(background,(0, 0))
screen.blit(platform,(0, 455))
screen.blit(player, (playerx, playery))
# update screen
pygame.display.flip()
# limit to 20 frames per second
clock.tick(30)
# Close the window and quit
pygame.quit ()
You guys ought to see this.
Animanationating
Making tile-sets and animations for my game. Still have to learn how to program all this junk.
Also, anyone want some free art for games? I just need the practice and it’s less work for you. ;)
Deadlines
Working on a side scroller. Plan on having it done by july.
I’ll post art. Don’t steal it. ;)
Top-Down or Sidescroller
Adventure games with some RPG elements. Which is your favorite? Top-down, or sidescroller?
Next Project
Now that I’m in a programming class, I should have something to work on during the first 2 or 3 weeks. I already know what an include statement is, and what it does…
Now. Any ideas? I think I should work on my little text RPG. Or, maybe learn some interface stuff. I hear that’s a challenge! Maybe both?
Been quiet on here… time to change that! More andromeda, eh?
School.cpp
cout « “Sitting in programming class. Yesssssss!”;
336
Boy that’s lot’s of lines of rules…
#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;
int credits = 100;
string blank = "Blank";
string cherry = "Cherry";
string bar = "Bar";
string Dbar = "Double Bar";
string Tbar = "Triple Bar";
string red = "Red 7";
string jackpot = "Jackpot";
string reel1;
string reel2;
string reel3;
void rules()
{
srand(time(NULL));
int num1 = 1 + rand() % 128;
int num2 = 1 + rand() % 128;
int num3 = 1 + rand() % 128;
if (num1 <= 73)
reel1 = blank;
else if (num1 <= 78)
reel1 = cherry;
else if (num1 <= 94)
reel1 = bar;
else if (num1 <= 107)
reel1 = Dbar;
else if (num1 <= 118)
reel1 = Tbar;
else if (num1 <= 126)
reel1 = red;
else
reel1 = jackpot;
if (num2 <= 73)
reel2 = blank;
else if (num2 <= 78)
reel2 = cherry;
else if (num2 <= 94)
reel2 = bar;
else if (num2 <= 107)
reel2 = Dbar;
else if (num2 <= 118)
reel2 = Tbar;
else if (num2 <= 126)
reel2 = red;
else
reel2 = jackpot;
if (num3 <= 73)
reel3 = blank;
else if (num3 <= 78)
reel3 = cherry;
else if (num3 <= 94)
reel3 = bar;
else if (num3 <= 107)
reel3 = Dbar;
else if (num3 <= 118)
reel3 = Tbar;
else if (num3 <= 126)
reel3 = red;
else
reel3 = jackpot;
}
void barCombos()
{
if ((reel1 == bar && reel2 == bar) && (reel3 == Dbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == bar && reel2 == bar) && (reel3 == Tbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == bar && reel2 == Dbar) && (reel3 == bar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == bar && reel2 == Dbar) && (reel3 == Dbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == bar && reel2 == Dbar) && (reel3 == Tbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == bar && reel2 == Tbar) && (reel3 == bar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == bar && reel2 == Tbar) && (reel3 == Dbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == bar && reel2 == Tbar) && (reel3 == Tbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Dbar && reel2 == bar) && (reel3 == bar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Dbar && reel2 == bar) && (reel3 == Dbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Dbar && reel2 == bar) && (reel3 == Tbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Dbar && reel2 == Dbar) && (reel3 == bar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Dbar && reel2 == Dbar) && (reel3 == Tbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Dbar && reel2 == Tbar) && (reel3 == bar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Dbar && reel2 == Tbar) && (reel3 == bar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Dbar && reel2 == Tbar) && (reel3 == Dbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Dbar && reel2 == Tbar) && (reel3 == Tbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Tbar && reel2 == bar) && (reel3 == bar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Tbar && reel2 == bar) && (reel3 == Dbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Tbar && reel2 == bar) && (reel3 == Tbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Tbar && reel2 == Dbar) && (reel3 == bar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Tbar && reel2 == Dbar) && (reel3 == Dbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Tbar && reel2 == Dbar) && (reel3 == Tbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Tbar && reel2 == Tbar) && (reel3 == bar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
if ((reel1 == Tbar && reel2 == Tbar) && (reel3 == Dbar))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
}
}
void play()
{
rules();
cout << "\n \n \n \n \n" << endl;
cout << "You have inserted 5 credits... ";
credits = credits - 5;
cout << "You now have " << credits << " credits.\n" << endl;
cout << "*The slots spin* "
<< reel1 << " - "
<< reel2 << " - "
<< reel3 << endl;
if ((reel1 == reel2 && reel2 == reel3) && (reel3 == cherry))
{
cout << "+12 Credits!" << endl;
credits = credits + 12;
cout << "You have " << credits << " credits!";
}
if ((reel1 == reel2 && reel2 == reel3) && (reel3 == jackpot))
{
cout << "+1600 Credits!" << endl;
credits = credits + 1600;
cout << "You have " << credits << " credits!";
}
if ((reel1 == reel2 && reel2 == reel3) && (reel3 == red))
{
cout << "+300 Credits!" << endl;
credits = credits + 300;
cout << "You have " << credits << " credits!";
}
if ((reel1 == reel2 && reel2 == reel3) && (reel3 == Tbar))
{
cout << "+100 Credits!" << endl;
credits = credits + 100;
cout << "You have " << credits << " credits!";
}
if ((reel1 == reel2 && reel2 == reel3) && (reel3 == Dbar))
{
cout << "+50 Credits!" << endl;
credits = credits + 50;
cout << "You have " << credits << " credits!";
}
if ((reel1 == reel2 && reel2 == reel3) && (reel3 == bar))
{
cout << "+25 Credits!" << endl;
credits = credits + 25;
cout << "You have " << credits << " credits!";
}
if (reel1 == reel2 && reel2 == cherry)
{
cout << "+6 Credits!" << " You have: " << credits << endl;
credits = credits + 6;
}
if (reel1 == reel3 && reel3 == cherry)
{
cout << "+6 Credits!" << " You have: " << credits << endl;
credits = credits + 6;
}
if (reel2 == reel3 && reel3 == cherry)
{
cout << "+6 Credits!" << " You have: " << credits << endl;
credits = credits + 6;
}
if ((reel1 == cherry) && (reel2 != cherry && reel3 != cherry))
{
cout << "+3 Credits!" << " You have: " << credits << endl;
credits = credits + 3;
}
if ((reel2 == cherry) && (reel1 != cherry && reel3 != cherry))
{
cout << "+3 Credits!" << " You have: " << credits << endl;
credits = credits + 3;
}
if ((reel3 == cherry) && (reel1 != cherry && reel2 != cherry))
{
cout << "+3 Credits!" << " You have: " << credits << endl;
credits = credits + 3;
}
else
cout << "You have: " << credits << endl;
barCombos(); // Put barCombos(); here!!!
string answer;
if (credits < 5)
cout << "That's what you get for gambling :)" << endl;
cout << "Would you like to play again? (y/n): ";
cin >> answer;
if (answer == "y" && credits >= 5)
play();
else if (answer == "y" && credits < 5)
cout << "Nice try..." << endl;
else if (answer == "n")
cout << "Come back some other time!" << endl;
else
cout << "Bad entry." << endl;
}
int main()
{
string answer;
cout << "Welcome to the slot machine..." << endl;
cout << "You currently have " << credits << " credits." << endl;
cout << "Would you like to lose some money? (y/n): ";
cin >> answer;
if (answer == "y")
play();
else if (answer == "n")
cout << "Come back some other time!" << endl;
else
cout << "Bad entry." << endl;
return 0;
}
It’s been interesting learning how slot machines work. DON’T DO IT!
Also: I could have put if () else if () else if () etc… But I liked to just paste it all in. It’s good VIM practice. :)
So Much Glitch Mob
Glitch mob is awesome.
#include <iostream>
using namespace std;
int main()
{
string Name;
cout << "Enter your name: ";
cin >> Name;
cout << "Your name is " + Name + "!"
<< endl;
return 0;
}
Opened a bunch of tabs of cpp docs/tutorials and installed a compiler on my Mac.
Andromeda - Concept
I know this post is not relative to me learning programming, but it kind of is. I am also going to start posting progress on here; concerning Andromeda.
I kinda have a mini team of people, and we have started fleshing out the game. I am working on lots of concept, and we have a storyline basis that we are going to go off of. I got ol’ photoshop (not old) set up, and whipped out the bamboo. Gonna start doing some concept art, and hopefully make a presentation full of concept and info about the game, for the team.
Just a quick update on what’s up :)
This doesn’t mean I’m not working on programming still. I am. So, ha!
Concept n’ Slots
So. I have been doing a bunch of writing and concept art for Andromeda.
Shelley: Do you have google plus? If you’d like, we could start putting a team together? I would like to get this going. (If you are still up to it) =]
Isak: Teach me Svenska… and you should help too. lol.
Anyways, I still have lots to work on with Andromeda before it can start production. I plan on this being a rather largish project, but not many people.
Also… I was looking at ridentbyte’s posts, and he is making a slot machine :) I think that would be cool (if you don’t mind, kind sir) to make a text version of that.
Anyways. That’s where I’m at.
Boom! Roasted.
varI = float(raw_input("Enter a number: "))
varI2 = float(raw_input("Enter another number: "))
type = float(raw_input("""
1. Add
2. Subtract
3. Multiply
4. Divide
"""))
while 1 == 1:
if type == 1:
print "The sum is:", varI + varI2
break
elif type == 2:
print "Your answer is:", varI - varI2
break
elif type == 3:
print "Your answer is:", varI * varI2
break
elif type == 4:
print "Your answer is:", varI / varI2
break
else:
print "Try again later..."
break
More soon. Promise. Been hard with no net, but just got it all set up about 10 minutes ago :D
Success
Got my two settings. Might add a :split. Still seeing if I like vertical or horizontal split better. Picky, right?
Anyways. I’m tired. Been driving all day. I’ll post my python progress tomorrow ;)