Results 1 to 3 of 3

Thread: My Tile Based Game (Feel free to continue if you would like to)

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2015

    Smile My Tile Based Game (Feel free to continue if you would like to)

    After lot's of help from vbforums.com, I completed a simple Tile Based Game project. Thank you, everyone for your help (too numerous to mention). Previously I had a bunch of different accounts. This is my last account based on completing a project.

    The application is ready to run. You need both zip files. 1 is the assets (*.gif images) and 2 is the sources. There is a variable at the top of frmMain called assetPath. Please be sure to update it to the correct path where you put the assets. Other than that, it is a simple project for a Tile Based game, that is a little mix between Zelda and Bard's Tale (original not enhanced version). It is not a complete game, so you need to extend it with your own effort to turn it into a working game. The graphics are GDI+ on purpose, to get a basic prototype done. If you need a pointer, then I recommend using this code and rewriting it using the latest .NET version of SFML. It is an excellent graphics library which works great with Visual Basic .NET.

    Though there are no version specific requirements, I used Visual Studio 2013 Community Update 4 to put this together, but I was originally working with Visual Basic 2010.

    I hope this helps a future game developer. I will not be making any updates, so feel free to hijack this thread if you want to. I do mean, anyone can take responsibility for all the code and answer questions. I want to remind you guys, that I would not have been able to put this together without all the great help here in the forums.

    Thank you and good luck to other beginning game programmers.


  2. #2
    New Member
    Join Date
    Feb 2018

    Cool Re: My Tile Based Game (Feel free to continue if you would like to)

    I had to reopen a new account (I keep losing my forum accounts). I got back to visual basic, since I kind of left this tile engine as a rough example. Here is an update.

    This is a new project. It is done with Visual Basic in SharpDevelop 4.4. I believe it can be imported into Visual Studio, but someone should confirm that first. The other way around it does work, you can import Visual Studio projects into SharpDevelop 4.4.

    This is a more complete example but it's without comments. This time, the map can be larger then the view area and there is a margin you can adjust for scrolling as the player nears the edges of the map. Try it. You can use the standard WASD keys. There is blocking which is set for the characters and there is per position blocking that you can set for each position on the map.

    If you examine the code, you will notice that on the map if you enable blocking for a position and you run into it, then you stop and if you go again you can move. It unblocks. This is a quick setup

    for automatically opening a door. You can enhance this or require a keypress to open doors and etc.

    The form is setup to be 1920x1080, but the view area is 1440x960, so you can safely resize the form around that if you need more space. I believe one of the most confusing constructs was to

    get the margin working correctly, so most of the logic for this is in the KeyDown event. Even if it looks tricky, its very stable so if you need to understand it, just use one direction and disregard

    all other directions. If you are a newer programmer, that tip might save you some time. So for example the D key is move right. Just examine the code in the D key, to get an idea of how the margin

    is used. The initial margin "mgn" is set to 4 and it should be not set to more than half of the shorter (width or height) of the map view area. Since the height is 20 as the width is 30, it should not be

    set to more than 8 - 10.

    One last note you don't need to worry about until you try to examine the code in detail. In the LoadMap routine, after the player x and y is declared, the offset x and y are calculated. This looks

    cryptic, but it's only necessary at that point. If you place the player x, y somewhere deeper in the map, the view has to be adjusted to that point. Those 2 code snippets, ensure that the margin

    is properly calculated into the position, so the start of movement is stable. you can mostly disregard that code, it's only needed there.

    Feel free to use the code in anyway, you can cut and paste it verbatim or alter it, it's up to you but it's free for anyone to use and learn from. You are also free to use the graphics, I did not attach

    a license to them.

    ... There is a pics directory with 2 images in the project.
    Attached Files Attached Files

  3. #3
    New Member
    Join Date
    Feb 2018

    Re: My Tile Based Game (Feel free to continue if you would like to)

    Here is a quick screenshots.
    Name:  screenshot.jpg
Views: 1656
Size:  11.2 KB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width