Jump to content

  • Log In with Google      Sign In   
  • Create Account


aanthonyz1

Member Since 22 Feb 2011
Offline Last Active Apr 16 2014 09:21 AM
-----

Topics I've Started

How can I make this cleaner...

27 March 2014 - 09:26 AM

Ok im making a Visual Novel and im starting to run into a problem. I wanna fix it before it gets worse lol. So the way I have been programming this is that every picture has a different number assigned to it. I have 3 switch statements, one for input, one for setting textures, and one for displaying. Is there a way to simplify this? 

#include "Backgrounds.h"


int menu_selector = 0;

int main()
{
	window.create(sf::VideoMode(1920,1080), "_______: The Beginning",sf::Style::Fullscreen);
	window.setKeyRepeatEnabled(false);
	window.setMouseCursorVisible(false);
	sf::Time time = sf::seconds(2);
	LoadFile();		//Loading Images, etc
	sf::Text text1("Ryuuji : To think I ended up dying in a shitty place like this...", font, 50); //77 Characters
	text1.setPosition(100,720);
	sf::Text text2("One moment I'm going out with this cute girl and the nexy, I get stabbed in the chest with", font, 50); //77 Characters
	text2.setPosition(100,790);
	sf::Text text3("a spear. What to do now...just wait? Hmm, I wish I had more time to at least say goodbye", font, 50); //77 Characters
	text3.setPosition(100,860);
	sf::Text text4("to my family. I never even got my first kiss...how pathetic can I be. I never even got to", font, 50); //77 Characters
	text4.setPosition(100,930);
	sf::Text text5("touch her boobs. I wonder if I can remember how she looked like. Let me try...", font, 50); //77 Characters
	text5.setPosition(100,1000);
	
    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
			{window.close();}
			if (event.type == sf::Event::MouseMoved)
			{
				mousesprite.setPosition(event.mouseMove.x,event.mouseMove.y);
			}
			if (event.type == sf::Event::KeyPressed)
			{
				if(event.key.code == sf::Keyboard::Escape)
				{window.close();}
				
						switch(game_state)
						{
							///////////////////////////////////////////////////////MainMenu
						case 0:
							if(event.key.code == sf::Keyboard::Up)
							{
								menu_selector--;
								if(menu_selector < 0) {menu_selector = 0;}
							}
							if(event.key.code == sf::Keyboard::Down)
							{
								menu_selector++;
								if(menu_selector > 3) {menu_selector = 3;}
							}
							if(event.key.code == sf::Keyboard::Return)
							{
								switch(menu_selector)
								{
								case 0:
									game_state = 3; //Introduction
									break;
								case 1:
									game_state = 1; //Load Screen
									break;
								case 2:
									game_state = 2; //Credits
									break;
								case 3:
									window.close();
									break;
								default:
									break;
								}
							}
							break;
							/////////////////////////////////////Load Screen
						case 1:
							break;
							////////////////////////////////////Credits
						case 2:
							break;
							///////////////////////////////////Introduction
						case 3:
							if(event.key.code == sf::Keyboard::Return)
							{
								game_state = 4;
							}
						default:
							break;
						}
				}
			
        }
		/////////////////////////////////////////////////
		switch(game_state)
		{
			case 0:	//Main Menu
				BG.setTexture(_0);

				break;
			case 1:	//Load Screen
				BG.setTexture(_1);
				break;
			case 2:	//Credits
				BG.setTexture(_2);
				break;
			case 3:	//Intro
				BG.setTexture(_3);
				
				break;
			case 4:	//BG1
				BG.setTexture(_4);
				break;
			default:
				break;
		}
		//window.clear(sf::Color(0,0,255));
		
		window.draw(BG);
		if(game_state == 3)
		{
		window.draw(npc1);
		window.draw(textframe);
		window.draw(text1);
		window.draw(text2);
		window.draw(text3);
		window.draw(text4);
		window.draw(text5);
		}
		window.draw(mousesprite);
        window.display();
    }

    return 0;
}

Any help would be appreciated


SFML Visual Novel and Lua

24 March 2014 - 11:33 AM

Hello, I have a few questions regarding the usage of SFML and Lua. I want to create a visual novel, using SFML but im confused with the loop of it. First off, I know there are programs like Novelty, etc that can do it for me but since im only making one novel, I wanna code it by hand. My questions regarding this:

 

  • How would I go about programming the loop for this? Would a bunch of nested switch statements work or is there a neater or simpler way?
  • My plan was to have 3 variables; story_spot, image_spot, text_spot. These are just made up names by the way just wanted to use it as an example. As the user picks choices, it would update each to a different integer number which would then change the text, image, etc. I guess this goes along with my first question but is this how I should be looking at it?
  • I have heard people using Lua for game programming, is it something I should be using for this, if so what parts exactly? Im still not completely clear on the entire concept and usage of Lua but from what I have heard its mainly used for NPC functions and dialogue. If it is used for situations like that, should I be looking into using it for my dialogue. My plan in terms of dialogue was to have different files for different parts of the story and when "text_spot" would switch, so would the .txt file that the program was reading from.

Any help would be appreciated.


Can anyone explain the concept of a game loop?

10 January 2014 - 02:36 PM

For example lets say I want to create a Visual Novel. Im trying to figure out how I can create a proper game loop where, the story will progress. So far this is what I normally do when I want to create a "story". -Check what to draw(ill explain more) -Draw Scene -Input -Rest

For checking what to draw, lets say I have Option 1 and Option 2, in a function, I would have a switch statement nested into another switch statement, in another, etc...and each switch statement would have choices 1-4 maybe, where it would draw a scene based on a number that was assigned to it under that switch statement, like this:

You have choice 1 or 2... switch(choice)

case 1: draw(asdf) switch(choice2) case 1:

case 2:

case 2: draw(zxcv) switch(choice2) case 1:

case 2:

I know that is definitely not how you do logic and input so I was wondering what you guys would do in a situation like this.


How is the Game Development field?

10 January 2014 - 01:54 PM

Ok I am currently in college in my first year. I want to go into game development but im confused with my major choices. Would Computer Science be enough or would I have to go to a school that has game programming as a major? How is the field and job availability overall?


Deciding between an Engine and Framework

05 January 2014 - 12:36 AM

Ive been programming for a while now. I recently got into game programming as well. This is gonna be a solo project and im trying to decide between which would benefit me more or at least ease the journey of doing this solo. I know most people would say use an engine since it has everything inside but at the same time I dont want to have most of what I need available to me. I want to create a game that will show the effort I put into it. If you want specifics so you can specifically recommend an engine/framework then here it is:

  • 2D/3D Capability
  • Video playback(Although I can just use a library for this)
  • C++ Oriented

If you want actual detailed information. In short, I want to create a 3D arena game where you unlock characters by playing through a 2D the character's storyline game(completely seperate game from the arena).

Ive seen people talking about Ogre3D and Irrlicht but I want to hear other opinions or if I should just forget about using an engine and use a framework instead.

Any help would be appreciated


PARTNERS