Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


My game's beta is finished but it won't run on other comptuers


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
17 replies to this topic

#1 LAURENT*   Members   -  Reputation: 237

Like
1Likes
Like

Posted 27 June 2014 - 07:16 PM

I've come so far and now I'm almost ready to release my first beta. my beta doesn't work on other computers. I'm mainly talking about the application file. Anyways here some info. I used visual studios 2010 to create my game. The extension library is SDL 1.5 from lazy foo. When I run the application I can't seem to move my character with key press. How do you make visual studios 2010 applications run on other computers?

 

 

EDIT!

 

Here is my game source code included. This is a isometric platformer tic tact toe game. If you're looking to make tic tact toe or a isometric platformer use my source code for whatever you want. I don't really care.

 

https://www.mediafire.com/?9natkpirh64aded


Edited by LAURENT*, 29 June 2014 - 07:06 AM.


Sponsor:

#2 slicer4ever   Crossbones+   -  Reputation: 3944

Like
10Likes
Like

Posted 27 June 2014 - 07:28 PM

just to clarify for people that would help(because he was in chat, and left abruptly):

 

1. the game does RUN, but it has different inputs, this is likely because he doesn't initialize his variables(this is apparently his current code base: http://www.gamedev.net/topic/658165-having-problems-with-scrolling-platform/)

 

2. these are the images he gave us:

expected result:

scene1_zpsad89caaa.png

 

result on other pc:

windows7_zps6534d466.png

 

with that out of the way! LAURENT*, you do not set x/y/z to 0, nor do you set xvel/yvel/zvel to 0.

 

in short, initialize your variables!


Edited by slicer4ever, 27 June 2014 - 07:35 PM.

Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

#3 Lactose!   GDNet+   -  Reputation: 3583

Like
6Likes
Like

Posted 27 June 2014 - 07:36 PM


in short, initialize your variables!

Like we said on chat :)



#4 LAURENT*   Members   -  Reputation: 237

Like
0Likes
Like

Posted 27 June 2014 - 07:38 PM

I did..... or I think I did and got the same result. I initialized everything.



#5 slicer4ever   Crossbones+   -  Reputation: 3944

Like
2Likes
Like

Posted 27 June 2014 - 07:38 PM

I did..... or I think I did and got the same result. I initialized everything.

post your current code then.


Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

#6 LAURENT*   Members   -  Reputation: 237

Like
2Likes
Like

Posted 27 June 2014 - 08:10 PM

#include <stdlib.h>
#include <stdio.h>
#include <SDL.h>
#include <SDL_image.h>
#include <time.h>
#include "tictactoe.h"

void Game::showMovement(int x, int y, SDL_Surface* screen, SDL_Surface* source, SDL_Rect* clip = NULL)
{
	//Holds offsets
    SDL_Rect offset;

    //Get offsets
    offset.x = x;
    offset.y = y;

    //Blit
    SDL_BlitSurface( source, clip, screen, &offset);
}


void Game::showCharacterMovement(int fakeX, int z, SDL_Surface* screen, SDL_Surface* source, SDL_Rect* clip = NULL)
{
	//Holds offsets
    SDL_Rect offset;

    //Get offsets
    offset.x = fakeX;
    offset.y = z;

    //Blit
    SDL_BlitSurface( source, clip, screen, &offset);
}


void Game::hub(SDL_Surface *screen)
{
	x = 0;
	y = 0;
	fakeX = x;
	z = y + YS_HEIGHT;
	
	bool quit = false;
	//While the user hasn't quit
    
	while( quit == false )
    {
        //While there's events to handle
        while( SDL_PollEvent( &event ) )
        {
            //Handle events for the dot
            buttonInput();

            //If the user has Xed out the window
            if( event.type == SDL_QUIT )
            {
                //Quit the program
                quit = true;
				break;
            }
        }
		
		move( get_ticks() );
		if ((x > 100 + 11) && (x < 100 + 31) && (y < 100 + 64 ) && (y > 100 + 58 )) 
		{   y = 0;
			x = 0;
			z = 0;
			xVel = 0;
			yVel = 0;
			zVel = 0;
			break;
			

		}
		start();
		SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 255, 255, 255));

		showMovement(100, 100, screen, Door1 );
		showMovement((int) x, (int)y, screen, LandPad );
		showCharacterMovement((int) fakeX, (int) z, screen, Ysguy1);
		SDL_Flip( screen );

		
	} 
	play(screen);
}


void Game::buttonInput()
{		
	//If a key was pressed
    if( event.type == SDL_KEYDOWN )
    {
        //Adjust the velocity
        switch( event.key.keysym.sym )
        {
			case SDLK_UP: yVel -= YS_VEL_WALK; zVel -= YS_VEL_WALK; break;
            case SDLK_DOWN: yVel += YS_VEL_WALK; zVel += YS_VEL_WALK; break;
            case SDLK_LEFT: xVel -= YS_VEL_WALK; break;
            case SDLK_RIGHT: xVel += YS_VEL_WALK; break;
			case SDLK_SPACE: if(grounded == true){z -= 3; zVel -= YS_VEL_WALK + 20;} break; 
							// if(grounded == false) {}
        }
    }
    //If a key was released
    else if( event.type == SDL_KEYUP )
    {
        //Adjust the velocity
        switch( event.key.keysym.sym )
        {
            case SDLK_UP: yVel += YS_VEL_WALK; zVel += YS_VEL_WALK; break;
            case SDLK_DOWN: yVel -= YS_VEL_WALK; zVel -= YS_VEL_WALK; break;
            case SDLK_LEFT: xVel += YS_VEL_WALK; break;
            case SDLK_RIGHT: xVel -= YS_VEL_WALK; break;	
        }
    }
}


void Game::move( Uint32 deltaTicks )
{	
	landpadCoords.x = x;
	landpadCoords.y = y;
	landpadCoords.w = x + LANDPAD_WIDTH;
	landpadCoords.h = y + LANDPAD_HEIGHT;
	
	
	
	fakeX = x; 
    //Move the dot left or right
    x += xVel * ( deltaTicks / 1000.f );

    //If the dot went too far to the left
    if( x < 0 )
    {
        //Move back
        x = 0;
    }
    //or the right
    else if( x + YS_WIDTH > SCREEN_WIDTH)
    {
        //Move back
        x = SCREEN_WIDTH - YS_WIDTH;
    }

    //Move the dot up or down
    y += yVel * ( deltaTicks / 1000.f );

    //If the dot went too far up
    if( y < 0 )
    {
        //Move back
        y = 0;
    }
    //or down
    else if( y + YS_HEIGHT > SCREEN_HEIGHT)
    {
        //Move back
        y = SCREEN_HEIGHT - YS_HEIGHT;
    }

	
	
	if (z + YS_HEIGHT > y)			
	{ 
		grounded = true;	
	}	
	else if (z + YS_HEIGHT < y)
	{
		grounded = false;
	}
		

	if (grounded == true)
	{
		zVel = yVel;
		z = y - YS_HEIGHT + 1;
	}		
	else if (grounded == false)
	{	
		zVel += ACCELARATION * ( deltaTicks / 1000.f );
		z += zVel * ( deltaTicks / 1000.f );
	}

	
}


Header file

#include <string>

class Game
{	 
	public:	
		//Game();

		Game::Game()
		{
			circle = IMG_Load("circle.jpg");  
			croix = IMG_Load("croix.jpg"); 
			board = IMG_Load("board.jpg"); 
			horizontale = IMG_Load("horizontale.jpg");
			verticale = IMG_Load("verticale.jpg");
			diagonale1 = IMG_Load("diagonale1.png");
			diagonale2 = IMG_Load("diagonale2.png");
			button = IMG_Load("button.png");
			Door1 = IMG_Load ("Door1.png");
			// Characters
			Ysguy1= IMG_Load("Ysguy1.png");
			LandPad = IMG_Load("LandPad.png");
			//Timer variables and functionality
			startTicks = 0;
			pausedTicks = 0;
			paused = false;
			started = false;

			//Const numbers that should never change
			 YS_VEL_WALK = 100;
			 YS_HEIGHT = 25;
			 YS_WIDTH = 19;
		     SCREEN_WIDTH = 589;
			 SCREEN_HEIGHT = 404;
			 ACCELARATION = 300;
			 LANDPAD_WIDTH = 19;
			 LANDPAD_HEIGHT = 7;
		};

		void meun (SDL_Surface* screen);
		void characters(SDL_Surface* screen);
		void play(SDL_Surface* screen); //F1
		int check_victory(SDL_Surface* screen); //F2	
		/***************************************************************************************/
		/////////////////////////////////////////////////////////////////////////////////////////
		////////////////////////////////MOVE PUBLIC FUNCTIONS///////////////////////////////////
		/////////////////////////////////////////////////////////////////////////////////////////
		/***************************************************************************************/
		
		void buttonInput();
		void hub(SDL_Surface* screen);
		void move (Uint32 deltaTicks);
		void showMovement(int x, int y, SDL_Surface* screen, SDL_Surface* source, SDL_Rect* clip);
		void showCharacterMovement(int x, int z, SDL_Surface* screen, SDL_Surface* source, SDL_Rect* clip);
		/***************************************************************************************/
		/////////////////////////////////////////////////////////////////////////////////////////
		////////////////////////////////TIMER PUBLIC FUNCTIONS///////////////////////////////////
		/////////////////////////////////////////////////////////////////////////////////////////
		/***************************************************************************************/
		void start();
		void stop();
		void pause();
		void unpause();

		//Gets the timer's time
		int get_ticks();

		//Checks the status of the timer
		bool is_started();
		bool is_paused();
			
		Game::~Game()
		{
			SDL_FreeSurface(horizontale);
			SDL_FreeSurface(verticale);
			SDL_FreeSurface(diagonale1);
			SDL_FreeSurface(diagonale2);
			SDL_FreeSurface(croix);
			SDL_FreeSurface(circle);
			SDL_FreeSurface(button);
			SDL_FreeSurface(board);	
			SDL_FreeSurface(Door1);	
			SDL_FreeSurface(LandPad);	
			SDL_FreeSurface(Ysguy1);	
		};

		//~Game();
		


	private:
		SDL_Event event;
		enum {EMPTY, CIRCLE, CROSS};
		
		/***************************************************************************************/
		/////////////////////////////////////////////////////////////////////////////////////////
		////////////////////////////////IMAGE PRINTING PRIVATE VARIABLES/////////////////////////
		/////////////////////////////////////////////////////////////////////////////////////////
		/***************************************************************************************/
		SDL_Surface *board, *circle, *croix, *horizontale, *verticale, *diagonale1, *diagonale2, *button, *Ysguy1, *LandPad, *Door1;
		
		
		int meunSelect;
		int continuer,  turn,  end, nowinner, xCoordinate, yCoordinate;
		int space1, space2, space3, space4, space5, space6, space7, space8, space9;  
		SDL_Rect boardPosition, positionforme, positionwon;
		SDL_Rect button1, button2, button3, button4, button5, button6, button7, button8, button9;
		bool quit;
		/***************************************************************************************/
		/////////////////////////////////////////////////////////////////////////////////////////
		////////////////////////////////TIMER PRIVATE VARIABLES//////////////////////////////////
		/////////////////////////////////////////////////////////////////////////////////////////
		/***************************************************************************************/
		//The clock time when the timer started
		int startTicks;

		//The ticks stored when the timer was paused
		int pausedTicks;

	    //The timer status
		bool paused;
		bool started;

		/***************************************************************************************/
		/////////////////////////////////////////////////////////////////////////////////////////
		////////////////////////////////MOVER PRIVATE VARIABLES//////////////////////////////////
		/////////////////////////////////////////////////////////////////////////////////////////
		/***************************************************************************************/
		float x, y, z;
		float fakeX;
		float xVel, yVel, zVel;
		float ACCELARATION;
		int YS_VEL_WALK;
		int YS_HEIGHT;
		int YS_WIDTH;
		int SCREEN_WIDTH;
		int SCREEN_HEIGHT;
		int LANDPAD_WIDTH;
		int LANDPAD_HEIGHT;
		int leftA, leftB;
		int rightA, rightB;
		int topA, topB;
		int bottomA, bottomB;

		bool grounded;
		
		SDL_Rect landpadCoords;
		
};




#7 slicer4ever   Crossbones+   -  Reputation: 3944

Like
7Likes
Like

Posted 27 June 2014 - 08:20 PM

like i said, initialize xvel/yvel/zvel!


Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

#8 LAURENT*   Members   -  Reputation: 237

Like
1Likes
Like

Posted 27 June 2014 - 08:29 PM

It didn't work........



#9 slicer4ever   Crossbones+   -  Reputation: 3944

Like
4Likes
Like

Posted 27 June 2014 - 08:38 PM

post the code to start and get_ticks.


Check out https://www.facebook.com/LiquidGames for some great games made by me on the Playstation Mobile market.

#10 mark ds   Members   -  Reputation: 1387

Like
7Likes
Like

Posted 28 June 2014 - 07:52 AM

What people mean by initialise your variables is that in Game::Game() you need to set them to their default starting values:

 

Game::Game()

{

    x = 0.0f;

    y = 0.0f;

    z = 0.0f;

 

    xVel = 0.0f;

    yVel = 0.0f;

    zVel = 0.0f;

}

 

If necessary replace the 0.0f with whatever their initial values should be.


Edited by mark ds, 28 June 2014 - 07:54 AM.


#11 Vortez   Crossbones+   -  Reputation: 2704

Like
6Likes
Like

Posted 28 June 2014 - 09:50 AM

My suggestion is learn to use the debugger and find why your character start at this odd place. Using a debugger is really not that hard.



#12 ProtectedMode   Members   -  Reputation: 1257

Like
6Likes
Like

Posted 28 June 2014 - 01:39 PM

Clearly the problem is the position of the object. So the only thing you have to do is set breakpoints at the end of the constructor and inside the setter function for the position. Then you go through all hits until you see the position is being set to a position you don't like. Then you look at the call stack to see what function is messing with the position. Then you can go from there.



#13 LAURENT*   Members   -  Reputation: 237

Like
1Likes
Like

Posted 28 June 2014 - 04:23 PM

Done it works. All variables has been successfully initialized.



#14 mark ds   Members   -  Reputation: 1387

Like
6Likes
Like

Posted 28 June 2014 - 04:36 PM

Done it works. All variables has been successfully initialized.

 

I assume you confused the notion of "declaring" variables with "initialising" variables?

 

A word of advice - *always* assume the initial values of variables are random junk unless you explicitly tell them otherwise!



#15 LAURENT*   Members   -  Reputation: 237

Like
1Likes
Like

Posted 28 June 2014 - 04:41 PM

I think I might have mixed up the terms. I still have a long ways to go. Anyways here is the game ready to be played.

 

 

https://www.mediafire.com/?9natkpirh64aded

 

Step 1: Extract files zip file
Step 2: Open prototype folder
Step 3: Open second prototype folder
Step 4: Open third prototype folder
Step 5: Find "Prototype" Application file within the mess of other files
Step 6: Double click and run



#16 mark ds   Members   -  Reputation: 1387

Like
2Likes
Like

Posted 28 June 2014 - 07:43 PM

I'll have a look at some point on Sunday!



#17 Fredericvo   Members   -  Reputation: 420

Like
0Likes
Like

Posted 07 July 2014 - 09:11 AM

Just FYI my browser says "prototype.zip" is malicious and has been blocked. Not saying you had bad intentions lol.

I assume most of the executables that we people create and don't have signed officially by MS might be blocked by AV's or Chrome.



#18 #Include Graphics   Members   -  Reputation: 370

Like
2Likes
Like

Posted 09 July 2014 - 04:35 AM

Hi all,

 

I tested your game Laurent, it worked and I did liked smile.png

 

It remembered to me when i was younger and I programmed some games and it made me feel so nice.

 

I just entered the door and played Tic Tac Toe winning two times in the same game to the IA.

 

Thank you so much for this beta game guy biggrin.png


Edited by #Include Graphics, 09 July 2014 - 04:36 AM.





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS