forums

TNT Basic Forums > Programming Q&A
Introduction, plus a few questions
< Last Thread     Next Thread >
Author
Thread        Post A Reply

08-25-2010 14:16

Posted by:
Yakkers

Find more posts by Yakkers

It looks like this forum is kind of dying out (which is a shame), but either way I'd like to take a moment to introduce myself before I drown you in noob questions.

So I've been making games for a few years now using a program by the folks at MIT called Scratch. It's a simple "programming language" based on snapping blocks and brackets together rather than typing code. It has many flaws however, including poor framerates, only being able to access projects via their website, and lack of sprite duplication. Every object is its own object with its own scripts. I've been working with TNT for two reasons, I wanted something more powerful and adaptable, and I wanted to start working with real programming. So far I've experimented with an animated tank that can be moved around, and also I'm currently working on a tic tac toe game with several difficulty settings for the computer player.

Anyways, on to my question...
Like I mentioned in Scratch, there is no sprite duplication. So when I needed to make bullets or something of that nature, I would have to make several copies of the object and have the code cycle through them, making sure I had enough for them to each reach their destination before they cycled back and were fired again. Now I see with TNT multiple objects can be spawned, so long as they each have their own index number, so I think the premise is to have the program give each one its own index number. Only thing is I don't understand at all how I would go about doing that AND having code to keep track of each one's movement and collision detection, regardless of how many are on the screen.

So if anyone is still here, can someone help me past this little roadblock of mine?

08-25-2010 19:58

Posted by:
JHVipond

Location:
South Dakota

Find more posts by JHVipond

Welcome, Yakkers

Ah, another veteran of the Sawblade Software forums! I hope you enjoy working with TNT Basic.

I can't help with your projectile problem, so I'll leave that to other members of this forum. But I, too, have been working on a tic-tac-toe game in TNT Basic (porting an Atari BASIC game from a book by Fred D'Ignazio), hoping to expand it to either Tic Tac Dough or The Hollywood Squares. My problems have been with the computer's blocking strategy and with determining whether there are three X's or three O's in a row.

Again, have fun with TNT Basic!

08-25-2010 21:09

Posted by:
allnodcoms

Location:
hertfordshire (England)

Click Here to Email allnodcoms   Find more posts by allnodcoms

Welcome on-board...

I've got to admit that there's not as much activity on here now as there used to be, there are still a few die hards in here that keep it ticking over... albeit pretty slowly ;)

Your sprite problem: You have to remember that you're not working with 'fire and forget' objects with TNT. If you want something to move, you have to move it (far better IMHO). Easiest way to handle multiple bullets is to have several arrays to hold things like coordinates, images and status for example (dependant on your needs). Each element in those arrays represents a bullet - or bullet sprite - and in your main loop you just iterate through the arrays, if the status array says a bullet is live you display its image, at its coordinates plus its offset. You can also check your collisions here and change the status to 'exploding' when a collision is detected, or to 'dead' if it goes of screen etc...

Basically, unlike your previous development tool, TNT only holds the data for the 'object', your main loop contains all the functionality which directly manipulates that data, and therefor the object on screen.

Hope that's helped, but if you have any more problems please just let us know - and have fun with TNT, it's a great little piece of kit...

'Till next time...

Danny (nod the mod)

08-26-2010 16:55

Posted by:
Yakkers

Find more posts by Yakkers

Ah, good to see there are still a few regulars here despite it being so slow, kinda like back on Sawblade Software ;D

So anyways thanks, I'll be sure to try that out once I finish up my tic tac toe experiment and move on to something a little more ambitious.

I'm probably biting off a little more than I can chew with this however, so far I'm adding multiple difficulty levels for the computer and coding it to keep the player from putting it in a cat's-eye. It's going well, but slowly. I'm in familiar territory since this is mosly just if constructs and variables, which I'm used to working with in Scratch.

08-29-2010 23:21

Posted by:
Yakkers

Find more posts by Yakkers

I (mostly) finished my tic tac toe experiment. there are a few things I haven't implemented, but I'm not sure if I'll ever really bother with it so here it is.
http://www.mediafire.com/?5io94xx1xqvcx33

I never really realized how complex tic tac toe was until I tried to code a computer player for it... there are actually many ways to win by setting up two lines so only one can be blocked. Back when I was only aware of one or two ways to do this I had planned to code it to prevent the player from doing so, but I think that would be very complicated and most likely impossible to fully prevent.

So anyways, tell me what you think!

08-30-2010 01:18

Posted by:
JHVipond

Location:
South Dakota

Find more posts by JHVipond

Yakkers, your tic-tac-toe game is better than I could ever hope to do in TNT Basic. The human player should be allowed to choose whether to play as X or as O.

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.