Recent

Author Topic: Maze Game with BGRA, now FullScreen and Sizable!  (Read 4687 times)

lainz

  • Guest
Maze Game with BGRA, now FullScreen and Sizable!
« on: January 07, 2013, 07:50:42 pm »
Hi, here is another game using BGRABitmap, now it has a nice background file =)

The objective of the game is to move the green alpha block to the red alpha block, and make a kind of orange block with their combination ;)

How to play: use the mouse, you can click to the block you want to move or keep pressed the left button and move the block. Also you can use the arrows and wsad keys.

The game starts in FullScreen, but you can press F11 to go maximized with the title bar and you can restore the window and resize to the size you want..

Also now it works on any rotation mode of your monitor: 0° 90° 180° and 270°.

Download: I've added this game to BGRAControls SVN, this is a kind of control I think.. it only needs to be gathered on an object and placed in the components tab ;)

http://wiki.lazarus.freepascal.org/BGRAControls#Install

circular

  • Hero Member
  • *****
  • Posts: 4224
    • Personal webpage
Re: Maze Game with BGRA, now FullScreen and Sizable!
« Reply #1 on: January 08, 2013, 09:44:50 pm »
Oh I think I understand.

Is the maze randomly generated ?
Conscience is the debugger of the mind

lainz

  • Guest
Re: Maze Game with BGRA, now FullScreen and Sizable!
« Reply #2 on: January 08, 2013, 11:50:38 pm »
Nope but you can create a generator if you know how or if you know where I can found one.

The format is simple:
Code: [Select]
  level1.mapGraphics :=
    '000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000X000000000000000000000000000000000000000000000000000000000000000000000000000000';
  level1.mapProperty :=
    '2222222222222222222220002020220200022022212022000020020000022020202022002202202220200000200202020002200202200020000220222200220022002020200220200020202220020022202022002002020002022200200000200022000220020200220020002022202220202002202000222000000020200020220222220222002020200002202020200200220220222200002020220000002220202020020222220002202020022000020002022000220000020002000222222222222222222222';
  level1.mapSolve :=
    '2222222222222222222220002020220200022022202022000020020000022020202022002202202220200000200202020002200202200020000220222200220022002020200220200020202220020022202022002002020002022200200000200022000220020200220020002022202220202002202000222000000020200020220222220222002020200002202020200200220220222200002020220000002221202020020222220002202020022000020002022000220000020002000222222222222222222222';
  level1.mapKeyChar := '1'; // Player
  level1.mapSolidChar := '2'; // Wall   

BTW it can be replaced with boolean, I've keep this one with char because I'll use it with more types of blocks like movable blocks (to create a Sokoban game for example) and other things.

Also in this game the graphics are unused :P btw with this format you can draw blocks of different colors or textures.

circular

  • Hero Member
  • *****
  • Posts: 4224
    • Personal webpage
Re: Maze Game with BGRA, now FullScreen and Sizable!
« Reply #3 on: January 09, 2013, 04:29:35 pm »
There are different ways to create a random maze.

For example, you create a list of positions on the map. First you put one random coordinate into it.

Then, you repeat a loop, where you choose one of the existing positions at random (so a random index in the list). And you try to add a move in some direction. If you can, then you add the new coordinate in the list. If you cannot, then you remove that coordinate from the list.

Each time you add a position, you need to set it on the map. So at the end you have the complete map.
Conscience is the debugger of the mind

eny

  • Hero Member
  • *****
  • Posts: 1634
All posts based on: Win10 (Win64); Lazarus 2.0.10 'stable' (x64) unless specified otherwise...

 

TinyPortal © 2005-2018