forums

TNT Basic Forums > Games In Progress
Light Maze
< Last Thread     Next Thread >
Author
Thread        Post A Reply

11-19-2010 04:16

Posted by:
Connors

Location:
Albuquerque

Find more posts by Connors

This is literally my first post on this forum, so I don't know how often people check it, but I taught myself enough to make this basic game. I used the code from Tron to make the code for a maze/puzzle game with the light trails. You have to navigate the levels and hit the green goal.
I plan to add keys/doors and other elements when I have the time, and maybe make a particle effect for deaths.
http://sites.google.com/site/onronc

I'm open to any ideas for levels or otherwise!

My current issue is using draw commands to make levels.
I made procedures for some useful shapes but I want to try to make it easier. (so many coordinates...)

11-19-2010 15:17

Posted by:
JHVipond

Location:
South Dakota

Find more posts by JHVipond

Welcome to the TNT Basic forums! I hope you enjoy learning the language and creating your own games.

I tried out your Light Maze game, and it crashed after the very first level. For starters, I suggest you make the starting point easier to see when the level begins. It wasn't immediately obvious to me that I should use the arrow keys to go up, then left to reach the green ring.

11-19-2010 16:01

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Hi Connors...

@James - It's only one level mate, so when you hit the goal thingy it just bugs out...

I think it works fine... You could also make your 'simple shapes' into tiles and build the level visually with the map editor...
Just a thought!

Promising start though. If you have any questions or problems then drop us a line.

'Till next time...

Danny (nod the mod)

11-24-2010 17:47

Posted by:
Connors

Location:
Albuquerque

Find more posts by Connors

Efficiency (and Doors)

I've decided tile maps are the easiest way to add levels. However, I'm not sure how I'll switch from level to level, because sprites. And switching maps.
Similar problem is making doors that disappear on command, especially when the sprite numbers are different each level.
What's the best way to set up arrays for things in my levels?

The thing that got me stuck is examples like Bouncing Splats only have 1 set of X and Y values that doesn't have to change size, and they don't turn on and off.

11-26-2010 08:32

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Maps & Sprites & Stuff...

How to change Levels

A map is just a grid, and each square in that grid contains a value representing the type of terrain (or object, obstruction, item or whatever) at that location. To change levels you just need to load a new map when the player finishes the last one.

Maps can also contain 'objects' that you can place with the map editor. These things don't show up when the map is loaded and drawn, so you can use them to mark things such as start positions and so on.

Doors need to be displayed, so they are best handled with map tiles. You draw an open door on one tile type, and a closed door on another type. To 'Open The Door' you just swap the tiles over... The numbers aren't different each level, the open door tile is always the open door tile, it's just where you put it that changes, and it's location is held in the map data.

One set of X / Y values...

I've not looked at the examples for years now, but I'm guessing that the single pair of X and Y coordinates are pulled from an array within a loop. So while it may look like the values don't change, they are being altered by the loop that contains the assignment. The array index used to access the data is the loop index, so as the loop 'loops' it changes the place where the coordinates get their information from.

I think that about covers your questions, but if not then let me know and I'll try and sort it.

'Till next time...

Danny (nod the mod)

11-30-2010 23:22

Posted by:
Connors

Location:
Albuquerque

Find more posts by Connors

Fixed it up good

Hey, it's been a while since the last version, so I found out what to do myself. It's all fixed!
I also found an easy way to add new levels using maps and doors an keys work fine. (thanks to the objects in the map)
I used sprites for doors. I updated the same file on my site so anyone can go look at it. :D
Thanks for all the help, though.
Here's one thing I'm not sure about:
How do you make a build that can save data that loads the next time you run it? I'd like to be able to make it keep track of how many levels you've beaten and probably a few statistics.

12-02-2010 22:19

Posted by:
Yakkers

Find more posts by Yakkers

First of all welcome, it's always nice to see new members in a slow community such as this one.

Looks like you're off to a good start. And about saving data I'm not sure, that's also my next step to learn. I'd love to start implementing high score lists and such.

Also another thing - don't be afraid to ask questions, even ones that may seem stupid. I don't mind and I'm sure nobody else does either, I like being around to help people out.

12-03-2010 07:23

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Morning Guys...

You need a save game file.

The basic procedure here is to see if there is a save file already (File Exists()), if not you can create one (Create File()). Either way, you open the file and then read the data you want in, or write it out, depending on whether you're saving or loading.

Take a quick peep in the learning zone under files, it's all pretty straight forward but if you get stuck you know where to find me ;o)

Danny (nod the mod)

05-01-2011 05:14

Posted by:
Connors

Location:
Albuquerque

Find more posts by Connors

Menus (AAAAAH)

I have changed my mind. I decided that the RPG is going to be too time consuming. It's not gone, I'm just waiting until Summer when I have more time. I also really want to finish Light Maze since it's going so well.

I uploaded the project file for once since I really cannot understand this:
https://sites.google.com/site/onronc/LightMaze.tbproj.zip?attredirects=0&d=1

I have looked at this for ages and I do not understand why I can't get it to return to the menu after the final level. Perhaps it's actually freezing for some reason?
Here's what it should be doing:
in the code for when win = 1 it should set menu = 1 so the game returns to the menu screen. Instead it stops completely. I tried a few ways to fix the problem. I even took away the repeat loop (which I think I will keep since it makes no difference at all). Should I maybe use that goto statement to go to the top of the code?

05-01-2011 09:43

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Morning...

Ok, your basic problem is that you never 'tell' it to go back to the menu... Your game loop quits when pause<>0 (unlike your comment), and pause=1 when level > lastLevel. All well and good, but after that last wend, you don't tell it to go back, you just get your procedure definitions and EOF, so it quits. GOTOs are generally frowned upon in programming, but I personally happen to like them. The consensus is that GOTOs make code hard to read, but I disagree. I'd whack a GOTO after the last wend to jump to a label at the start of your Main Loop. You could throw in another while loop to enclose both the menu and the game loop, while game<>quit or something, but a simple jump is quicker.

For your menu loop, take a look at 'Wait Button Click'. I think that will clean up your menu code a fair bit, and a Wait Key Press would compress your level set up code (while alive = 0).

Apart from that I've got to say it's a nice little game. It works really well as a proof of concept, and with some snazzy graphics and a bit of thumping music in the background you could be on to a winner...

I make you right about the RPG btw, always good to get one game out the door at a time. Once you get engrossed in game 2, game 1 almost never gets finished, and a game 3 usually comes along to really spoil the party...

Nice work.

Danny (nod the mod)

05-01-2011 15:20

Posted by:
Connors

Location:
Albuquerque

Find more posts by Connors

Thanks Danny!

Thanks for all the help, I'll use GOTO then.
I was remembering a little article I found about "finishing" games, it was good. I remembered that and decided this was a better plan...
I just have one question, why didn't it work when the whole code was within a repeat loop? I think I need to learn what these do better.

05-01-2011 15:36

Posted by:
Connors

Location:
Albuquerque

Find more posts by Connors

WHAT THE

I think there was a miscommunication here, I tried GOTO and it made no difference. FYI the game does not quit when I say menu = 1, it actually just freezes at the end of level 9 and I have to manually quit. If you want to test it say int level=9 at the beginning.

05-01-2011 20:27

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Your right...

OK, re-read the code. You never set alive to anything else when you get past the last level, so it keeps going round in the "while alive=0" loop.

The previous comments still apply though... ;o)

Danny (nod the mod)

05-01-2011 20:43

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

P.S.

Just set alive=2 after last level. The while alive=1 loop will never execute and it will fall through to your GOTO and jump back to the menu...

Danny (nod the mod)

05-02-2011 03:33

Posted by:
Connors

Location:
Albuquerque

Find more posts by Connors

THANKS!

Well, thanks for that, I think all this will actually help with similar things in the RPG later.* Now I can concentrate on graphics, and that save file problem.
One quick question: where will directories such as User Prefs and System Prefs be exactly, and is it different when testing from within Heiroglyph?
...OK so more like two questions.


* Much, much later.

05-02-2011 08:10

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Two Answers...

It doesn't matter where the preference directories are if you use the Set Directory syntax, TNT will just sort it out for you. For reference though, the user prefs are always users/username/library/preferences, and the system (which you should generally leave alone for things like games) is just root/library/preferences.

The default file location for saves (for example, where TNT will put stuff unless you tell it otherwise) is the same directory as the application. This is generally a good bet, because when people zap your game (yeah, I know, why would they do that?) they actually zap the lot and don't get left with a load of stuff in the prefs folder.

As for the running 'compiled' and 'interpreted' versions, it makes no difference at all. It's the same file...

Have Fun...

Danny (nod the mod)

05-02-2011 20:20

Posted by:
Connors

Location:
Albuquerque

Find more posts by Connors

Once again, thanks for the info

Thanks for that, I got most of it worked out but it is good to know some more details on Set Directory... (for one thing I want to reset AKA delete the save to test everything.) I already got enough done to get it to save the current level. Looks like it's smooth sailing from here on! Just need to finish the graphics and make better menus. :D
To-Do List:
Menu
Level Select
Pause Menu
Controls preferences
More awesome levels
(Maybe) difficulty settings
Cool retro graphics

05-03-2011 06:21

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

No Problems

For the "Cool Retro Graphics" check out this link. You'll need to scroll right to the bottom (past all the cute Japanese stuff) and there are a couple of graphics sets for old, 8 bit shooters. The very last one should have some stuff you can use, and it's free!

Give it a look...

Danny (nod the mod)

05-04-2011 04:08

Posted by:
Connors

Location:
Albuquerque

Find more posts by Connors

Cool site

Thanks for the link, I'm going to look at this, HOWEVER I was planning on making my own graphics sets. But you did remind me of another thing, which is that I can look at this and other pixel art and try to draw inspiration from that. Anyways, I'll post here when I have a good playable build with real menus and such.

OH and by the way... Do you any of know this site called http://www.gamemakersgarage.com/ ? It's the place where I got a lot of help starting out when I only used Silver Creator, which is great for point-and-click adventure/puzzle games by the way.

05-04-2011 04:11

Posted by:
Connors

Location:
Albuquerque

Find more posts by Connors

Oops, sorry...

Accidental post, wasn't done.

Check out the forums, we always like getting new members.
[/shameless self promotion]

All times are GMT        Post A Reply

Forum Jump:
< Last Thread     Next Thread >

< Contact Us - TNT Basic >

Powered by: vBulletin Lite Version 1.0.1 Lite
Copyright © Jelsoft Enterprises Limited 2000.