# Visual Basic > Games and Graphics Programming > Game Demos >  VB: Gems 'N Rocks [Source]

## SLH

Hi all, for a while now i've been working on a tile-based game, using DX7, i'd appreciate your thoughts and comments.

The basic premise, is that you have to collect gems that are placed about the level, whilst avoiding various hazards. The simplist of these are rocks, which you can push around, and can crush you. The others i class as 'Mines' (for want of a better name). These mines all have different ways of moving (according to their colour). Some simple follow a wall, while others move in more complicated ways (such as an intelligent player-chasing mine).

If anyone is really interested in how i've done anything, i could post the source, but i'd need to comment it a bit more first i think.

Here's the game, hopefully it'll extract ok, just make sure you extract the zip with file paths enabled.

Thanks for any comments.

EDIT: Now you can get the source here


EDIT: This is the latest version with the resolution now selectable.

----------


## Kasracer

If you select the movement as the center or whatever it's listed as, the entire screen says in the center and jumps annoyingly as you move

The player won't die in the center mode, the things will fall on him and just stop before crushing him, however in the other movement if needed mode, it does kill him.

You waste way to much screen space, I could probably tile about 10 of your games within the screen space it leaves blank (white)

Just not liking it but not a bad try at a game

----------


## SLH

Thanks for the reply.





> _Originally posted by kasracer_ 
> *I could probably tile about 109 of your games within the screen space it leaves blank (white)*


What do you mean?

As for the player death/movement mode bug, i'll look into it. I don't really like the centrescreen movemode anyway, so i could just remove it.

----------


## Kasracer

> _Originally posted by SLH_ 
> *What do you mean?
> *


 I ment how there is a ton of white space aorund the little aprt of the game, I probably could tile 10 of those games using the empty white space. It was supposed to be 10 not 109

----------


## Electroman

Yea, the map movement doesn't seem to be what it says for me either  :Confused: . Wicked game tho. The player movement is a bit jurky aswel, are you using anything to control the movement in relation to the time for each loop??

----------


## SLH

Cheers for the comments.




> _Originally posted by Electroman_ 
> *Are you using anything to control the movement in relation to the time for each loop??*


Yes, i'm using gettickcount, with the player moving at a certain interval.

With a simple calculation i determine when the player can move, once he can (and the user presses a key), then it's set in motion towards the appropriate adjacent grid position.

The player's offset from his previous position is controled by how long ago he wanted to move (so that the player will move 1 unit just in time for him to move again).

using this formula:

Player.Offset = ((PlayerThinkTime - GetTickCount) / PlayerThinkInterval) * PicSize

playerthinktime is the time the player last moved, playerthinkinterval is how often the player can move and picsize is the size of 1 unit of the grid.


Depending on which movement mode you use, the player movement can be a little jerky sometimes. I suggest using the movement mode 'Move If Needed'.

----------


## Lee_S

I get

Run-time error '445':
Object doesn't support this action


when clicking the START button. Is this an XP problem or graphics problem or something else?

----------


## Electroman

Thats the method i'd of used aswell for controling the movement but the thing was I was moving down and the player sudenly jumped two rows really quick then went back to normal  :Confused: , oh well no worries, good work.

----------


## SLH

Lee_s: I'm using XP myself, so it can't be that. Do you have DirectX 7 or higher installed, because that's what it uses. Other than that i can't think of anything else.

Electroman: Strange. Ah well, if i want it to look like a windows game it's got to have microsoft-esk bugs  :Big Grin:

----------


## Lee_S

> _Originally posted by SLH_ 
> *Lee_s: I'm using XP myself, so it can't be that. Do you have DirectX 7 or higher installed, because that's what it uses. Other than that i can't think of anything else.*


Yup, Im using DirectX 9.0a. What resolution/colour depth is it meant to run in? I have a crappy gfx card in at the moment, maybe it cant set it right?

----------


## cyborg

really nice!  :Smilie:

----------


## SLH

> _Originally posted by Lee_S_ 
> *Yup, Im using DirectX 9.0a. What resolution/colour depth is it meant to run in? I have a crappy gfx card in at the moment, maybe it cant set it right?*



That's another thing i need to add - an options screen!


The resolution is 1280x1024 - i should DEFINATLY make that a configureable option..... Should be easy to change - at the moment it's just a public const.

----------


## SLH

> _Originally posted by cyborg_ 
> *really nice! *


Thanks!


Does anyone have any suggestions for extra items/graphics/monsters etc. that i could include in my game?

----------


## Kasracer

Lees: Do you have the .NET framework installed? Also, can your computer handle 1280 X 1024?

----------


## Electroman

That'll be the problem, my graphics card can cope with that res but the monitor will only go up to 1024*768. How come you didn't pick a popular res like 1024*768??

----------


## Lee_S

> _Originally posted by Electroman_ 
> *That'll be the problem, my graphics card can cope with that res but the monitor will only go up to 1024*768. How come you didn't pick a popular res like 1024*768??*


Same here.

LS - "I'll play it later, lol"

----------


## SLH

> _Originally posted by Electroman_ 
> *That'll be the problem, my graphics card can cope with that res but the monitor will only go up to 1024*768. How come you didn't pick a popular res like 1024*768??*


I didn't really think about incompatability, i just choose the resolution my desktop was in at the time (so that the ide didn't shrink when playing the program).

I've uploaded a version that has the option to change the resolution (it doesn't enumerate them yet though). You can get it at the top of this thread.

----------


## SLH

I've added some simplistic lighting (more to come), and uploaded the latest version (source) here

----------


## SteveCRM

the player just shows up as  a white box for me...  :Confused:  

only textures i get are the floor, and the rock is the background texture with a white box around it...

errr?  :Confused:

----------


## SLH

That's very wierd, no-one else has had that problem....

I take it you have DX7 or higher.

Otherwise i have no idea what the problem is.

----------


## Darkwraith

A little buggy (in Default 5, you blow up when you cross into the white square for some odd reason) and controls are a little odd (input sampling is not constant so sometimes you get runover) but all in all a good game.

----------


## wiz126

> Quote from SteveCRM 
> the player just shows up as a white box for me...  
> 
> only textures i get are the floor, and the rock is the background texture with a white box around it...
> 
> errr?


i am having this same problem too

bug?

----------


## SLH

It probably is a bug, but i can't replicate it so i can't really find out what causes it.
Even if i did i no longer use VB6 anyway, so i couldn't update the game anyway. Been a while since i've looked at the code for this!

----------

