Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Dec 2008
Offline Last Active Apr 26 2016 06:44 AM

#5274032 Who vs. whom

Posted by Wooh on 03 February 2016 - 06:29 AM

What is your opinion about using "whom" in games? Should it be used or should "who" be used everywhere?

I'm asking because I'm not a native speaker and I try to follow the grammar rules as much as possible, but the use of "whom" doesn't always sound right to me and it seems like many native speakers don't even use it.

#5272271 sdl 1.2 pacman problems

Posted by Wooh on 22 January 2016 - 12:09 PM

I know there are many ways you can do these things but if I decided to do a pacman game I would have made much more use of the fact that it's a tile-based game. The way I see it pacman's movement is from the center of one tile to the center of another tile.

Each time pacman reach the center of a tile I would check to see if it is possible to start move pacman in the new direction. If not, then continue in the current direction if possible.
if center of tile has been reached
	if can move in new direction
		start move in new direction
	else if can move in current direction
		continue moving in current direction

Note that when you check to see if it is possible to move from one tile to the next you don't need to do full-blown collision detection. If you know the coordinates of the tile you're on you can easily calculate the coordinates of the next tile and check what type it is (walkable or not).

#5271711 SDL2 Displays wrong image?

Posted by Wooh on 18 January 2016 - 10:33 AM

You destroy the texture in the nivel constructor but the texture is still used by the tile objects that you created.

#5270660 sdl 1.2 class constructor doesn't work somehow

Posted by Wooh on 12 January 2016 - 04:10 AM

Shouldn't you also assign values to enemybox.w and enemybox.h?

#5269363 Why do most RPG games uses range values for attack/defence?

Posted by Wooh on 05 January 2016 - 03:12 AM

If the damage was always the same a slight improvement in damage might not give you any advantages against a particular type of enemy.

If an enemy has 15 HP and you have a weapon that do exactly 5 in damage it would always take 3 hits to kill it. If you get hold of a weapon that do 6 damage you still need 3 hits to kill the enemy. A damage of 7 also makes no difference. You would need a weapon that do 8 damage before you could kill the same enemy with less hits.

5 damage: 15 -> 10 -> 5 -> 0 (3 hits)
6 damage: 15 -> 9 -> 3 -> 0 (3 hits)
7 damage: 15 -> 8 -> 1 -> 0 (3 hits)
8 damage: 15 -> 7 -> 0 (2 hits)

With a range it doesn't always take the same amount of hits to kill the enemy but if your weapon is slightly better it increases your chances of killing it in less number of hits.

4-6 damage: 4 hits: 37% , 3 hits: 63%
5-7 damage: 4 hits: 0% , 3 hits: 100%
6-8 damage: 4 hits: 0% , 3 hits: 67% , 2 hits: 33%
7-9 damage: 4 hits: 0% , 3 hits: 11% , 2 hits: 89%

#5226011 how to crop on SDL 1.2

Posted by Wooh on 28 April 2015 - 01:47 AM

The function you need to understand is the SDL_BlitSurface function.
int SDL_BlitSurface(SDL_Surface* src, SDL_Rect* srcrect, SDL_Surface* dst, SDL_Rect* dstrect);
src (first argument) is the SDL_Surface that you want to draw on to some other surface.
srcrect (second argument) is the rectangle that you want to cut out of src surface.
dst (third argument) is the SDL_Surface that you want to draw the src surface on.
srcrect (third argument) will decide where on the dst it will draw.

// The surface that we want to draw
SDL_Surface* src = SDL_LoadBMP("img.bmp");

// The area that we want to draw from img.bmp.
SDL_Rect srcrect; // The area is ...
srcrect.w = 100;  // ... 100x100 pixels ...
srcrect.h = 100;  //
srcrect.x = 0;    // ... with the top left corner located at position (0,50)
srcrect.y = 50;   //

// The surface that we want draw on.
SDL_Surface* dst = SDL_GetVideoSurface(); // The screen surface

// The position on the screen where the top left corner of the cropped image will be drawn.
SDL_Rect dstrect;
dstrect.x = 10;
dstrect.y = 20;
// w and h will not be used by SDL_BlitSurface.

SDL_BlitSurface(src, &srcrect, dst, &dstrect);

#5223901 FastCall Is Alll

Posted by Wooh on 17 April 2015 - 03:14 AM

The true horror though is that a lot of these already *have* alternative tokens:


I tried some of these alternitives but it failed to compile (VS9)
You have to disable microsofts language extensions...

#5223349 Template or Macro

Posted by Wooh on 15 April 2015 - 01:19 AM

I think you should prefer templates unless you have a good reason not to.

If you pass an array to SAFE_DELETE it will still compile, but using templates you can force this to give you an error.

int arr[5];

#5220697 please help with SDL

Posted by Wooh on 01 April 2015 - 08:36 AM

Make sure you don't have any circular include dependencies.

SDLGameObject.h includes Game.h, so if Game.h includes Player.h (or Enemy.h) it will fail to work because Player.h need SDLGameObject but it has not yet been defined and the #pragma once prevents SDLGameObject.h from being included again.

#5216580 Best way to store user settings?

Posted by Wooh on 15 March 2015 - 02:01 AM

If the user is supposed to be able to edit the file manually it should be as simple as possible.


Otherwise it doesn't matter.

#5216350 SDL2_gfx texturedPolygon function question

Posted by Wooh on 13 March 2015 - 04:52 PM

Ignore what I just said. I was wrong. The shape made up of vx and vy cuts out a piece of the texture but what part depends on texture_dx and texture_dy.

#5212309 Is buying assets cheating?

Posted by Wooh on 22 February 2015 - 01:52 PM

If you see games as art (like a painting or a piece of music) I say it has higher value if you do it yourself. Only you can say if it's cheating because only you know what you want to do.

#5211639 How to disable vsync in SDL 2?

Posted by Wooh on 19 February 2015 - 03:12 AM

As I understand the docs you can also pass the SDL_RENDERER_PRESENTVSYNC flag when creating the renderer.


#5208635 Why not chord tones?

Posted by Wooh on 04 February 2015 - 09:40 AM

In my quest to learn composing simple game music I thought I should study some old Mario songs because the simplicity of never having more than 3 notes at the same time. The Starman Theme starts with C, D and F. I thought this was a bit strange because these does not make up triad with notes a third apart.

To me it would make more sense if it used B, D and F because then they would be a chord consisting of a root, a third and a fifth. When I think about it I realize B, D and F would make up a B diminished chord so that would probably not sound very good but I don't understand how to think when using notes that are not part of a traditional chord. Why did they do it the way they did? Is there any "rules" to follow?

#5203067 Game event loop using ncurses library

Posted by Wooh on 09 January 2015 - 06:21 AM

The timeout function can be used to set how long getch will wait for input. timeout(0) will make getch() return immediately, and if there was no input the return value is ERR.