본문 바로가기

카테고리 없음

Vb6 Puzzle Game Source Code



Picture Puzzle. Submitted by: Oelasor. Friday, October 5, 2012 - 03:44. Do you have source code, articles, tutorials or thesis to share? Submit it here by clicking the link below. Save, Update, Delete Record in VB6.0. Download Manager. Students Records System Version 1.0. Bock Repair Parts Sales. Java Puzzle game. In this part of the Java games tutorial, we create a Java Puzzle game clone. The source code and the image can be foud at the author's Github Puzzle-game-in-Java-Swing repository.

Vb6 Puzzle Game Source Code
28 Mar 2004

Introduction

In this article, you can learn how to edit images without using Windows API or other functions. You will also learn how to dynamically move and edit the controls.

While making this program, I needed some functions which could crop, resize, clip the image. But .NET framework doesn't provide us with any of such tools. So I wrote all the functions on my own because I did not wanted to use any of the APIs.

Objective and How to play the Game

This game has three modes:

  1. Number Mode (I haven't programmed it yet, but it's very easy to do).
  2. Picture Mode.
  3. Number and Picture Mode.

In this game, there are 15 tiles or buttons which you have to arrange numerically, or if you are playing in the picture mode then you have to arrange the titles in order to get the image as shown on the right side.

In this game, there is one empty tile where other tiles can come. Only the adjoining tiles can take its place. Whenever you click a tile (button), it shifts towards the empty block if there is a way. Like this way, you have to arrange the tiles so as to make the image as shown in the figure on the right side.

Using the code

First of all, I created a Panel. I added 15 buttons to it. I stored all the buttons in an ArrayListalAllButtons. Each button's size is 80x80 pixel.

Now I load the default image and store it in a variable MainBitmap.

Now I have to make 15 pieces of this image and that to be of size 80x80 pixels. Here is the code to do that:

Vb6 puzzle game source code

Now add Images to the Buttons. This is achieved with the help of the following code:

Now I have to jumble all the buttons so that they all mix up and the user can play the game.

Now, whenever a button is clicked, it has to be moved to the empty point. A button is only moved when it is either horizontally or vertically inline with the empty point. This is checked with the help of the following code:

If this condition is satisfied then the button(s) is moved accordingly:

A ChangeImage function loads a random image from the database:

The rest of the code is self explanatory. For any help or information, please feel free to contact me.

History

First version: 18 March 2004 (On my birthday).

23 Feb 2005CPOL

Introduction

This is my first upload. This is just a two hours project and my first submission to The Code Project, so be indulgent ~('.')~

Vb6 Puzzle Game Source Code Free

I write this articles because I wish to share something I just learned. I remember that I am a beginner I can make a mistake. I have developed a Simple 2D game. I wrote this game program in my school days out of my interest in learning Visual Basic. I used the Visual Studio 6 for coding this.

The Game

I realize that a number of people will just want to try out the sample and see if it is worth spending the time looking at the source code. So I will first present the game, the controls, then I will explain how it works in later sections. This intermediate tutorial describes how to play Puzzle and how to Re arrange the numbers.
First, the user starts the game by clicking on OK:

Then a Main window appears. Here numbers are arranged randomly you have to arrange numbers in ordered way.

How is Puzzle played?

=> To swap a number with its adjacent empty block, just click the number. Continue this process until all numbers are arranged in a ordered way.

=>To end the game, click the icon in the upper right corner.

=>To view about the game, click the icon in the upper right corner.

=> To rearrange numbers, click button in the upper middle of screen.

Design

Java Game Source Code

The code is easy to read: this is not a bunch of unreadable code lines and the game is fully functional. I think it can be interesting for beginners.

Global Variable Declaration

The game is built up from a number of smaller sub-Modules. Each Module provides a distinct purpose. I have identified the Modules below.

  • CMD_Click( )
  • SWAP( )
  • COMPARE()

CMD_Click( )

If the Selected Block is Not in the First Row

If the Selected Block is Not in the Last Row

If Selected Block is Not in Last Column

If the Selected Block is Not in the First Column

SWAP ( )

Module to Swap Selected Number with Empty Block

COMPARE()

Module to Check that All Numbers are Arranged in Order or Not
If so, Show Win Screen

Tools

  • For testing your article and program in different screen resolutions [^]
  • An excellent tool for writing an article is (I'm using it right now) [^ ]

Conclusion

Buy Game Source Code

I would like to give credit and thanks to my brother Rohit Soam for constructive criticisms and editing. Thanks, brother.

History

Vb6 Puzzle Game Source Code

30-Jan-2001 - Initial Release of Article