forums

TNT Basic Forums > Programming Q&A
Timer problems
< Last Thread     Next Thread >
Author
Thread        Post A Reply

11-03-2002 00:12

Posted by:
Tony Rose

Click Here to Email Tony Rose   Find more posts by Tony Rose

Ok heres the deal...I want my bullets to be outside of my tank for 2000milliseconds before deleting. The problem is the way I have it setup looks right to me but it wont function.
Heres the relevant code with comments added...

'mTimer keeps the time updated always
mTimer=Timer

'If your press space bar and the Bullet Que is empty,set all the co-ordinates for the Bullet to travel to (those all work) and assign bTimer with the same number as mTimer at the time Space was pushed.

if pressed (49) and bQue=1
bQue=bQue+1
bTargX=TargX
bTargY=TargY
bSwitch=1
bAngle=tAngle
bTimer=mTimer
end if

'Heres the problem...in my logic this is how I see it...If you pressed space at say,2000ms into the game then bTimer would lock in at 2000ms. mTimer of course continues to grow in size. If bTimer is less than or equal to mTimer-2000 (Therefore in two seconds) then run the bullet reset functions(which work fine). But this If trigger wont work right.

if bTimer<=mTimer-2000
sprite off 4
bQue=bQue-1
bSwitch=0
bX=TankX
bY=TankY
end if

11-03-2002 00:35

Posted by:
Holmes

Click Here to Email Holmes   Find more posts by Holmes

hmm...

This seems like an odd way of programming it, but of course in my head any way other than how I'd do it is odd. Can you be more specific in your problem. What (if anything) happens when you try to shoot?

In the meantime, this code is REALLY starting to look like something I programmed to learn about TNT networking functions. Here's a link to the source code, it might help you in future problems:

http://solidmag.vze.com/TankLan.sit

11-03-2002 03:08

Posted by:
Tony Rose

Click Here to Email Tony Rose   Find more posts by Tony Rose

Nm

Oh just forget about my timer problem ;) Actualy it was just me getting frustrated with how I was doing my bullets and trying something else. But I dont need that anymore,thanks for the source,it has ALOT of stuff thats gonna come in handy for me. Especialy the bullet system,which I have never been able to get right in several mess around games ive made. Now that I see some of the ways you did It Im thinking "Duh" to myself. Good stuff. Also,why didnt you ever promote this game or finish it off? Looks quite cool actualy.

11-03-2002 21:42

Posted by:
Holmes

Click Here to Email Holmes   Find more posts by Holmes

I will be finishing this game sometime, but right now I'm focusing on my uDev game entry, Raptor.

http://solidmag.vze.com/raptor

Plus its really difficult for me to test out Network game's because I don't have multiple computers to test them on.

11-03-2002 22:03

Posted by:
Tony Rose

Click Here to Email Tony Rose   Find more posts by Tony Rose

Oh

Well if I could be of any help sometime,just ask. Ive got 3 Macs hooked up (Soon to be 4) on a network so I can test some of the networking stuff.

11-04-2002 00:55

Posted by:
Holmes

Click Here to Email Holmes   Find more posts by Holmes

Thanks, I'll remember that. The game I'm making after Raptor is called Theseus II, it'll be a sort of networked version of asteriods. Maybe you could help with that.

11-08-2002 10:56

Posted by:
mark_667

Find more posts by mark_667

Bug?

"Holmes",

I am sorry to say that after downolading 'TankLan' (using the link you reconmended on the TNT forums) the file was unopenable after been decompressed to 2.9 mb, I kept getting an 'end of file' error, I attempted to view it in ResEdit, only to find it didn't have a resource fork! After starting up the computer again later on, it opened perfectly in Hieroglyph, but was completely blank, the file size according to the OS 9 'get info' command showed it to be only 20k in size. Can you please post an updated one on your website? Thanks, Mark_667

PS. I did try the address on your website, but it did not work, so I used these forums instead.

11-09-2002 00:00

Posted by:
MikeS

Find more posts by MikeS

I'm doing something similar. I applied the moan M and A commands to the bullet sprite. The animate command has a built-in timer. Make a 2 image sprite, with the 2nd image just a blank frame that appears after a certain interval. ??

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.