Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 help with shooter game
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Schaef




PostPosted: Fri Feb 20, 2004 5:08 pm   Post subject: help with shooter game

This is just the start of a small shooter game that I am going to try to make. The problem with it is that when i reload it ends up taking more then one clip away. How can I make it so that the amount of clips only goes down once even if the reload button is held?


Shooter.zip
 Description:
Mouse to Fire, Tab to reload

Download
 Filename:  Shooter.zip
 Filesize:  147.26 KB
 Downloaded:  227 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
shorthair




PostPosted: Fri Feb 20, 2004 5:19 pm   Post subject: (No subject)

your using input.KeyDown thast your first problem , becuse that takes whats in the buffer , it knows when it was hit and relesed , you need to use getch i belive to just get it once , it only takes it character at a time till a charater matches ,i know that the proble m becuase blitz has a Input.KeyPressed , and Input.KeyDown, so i know its to do with that statement
Paul




PostPosted: Fri Feb 20, 2004 5:20 pm   Post subject: (No subject)

code:


Input.KeyDown(chars)
if chars (KEY_TAB) and clips >0 then
delay (100)
fork reload
end if

Computer is too fast, I changed it to here, and it works.
You can still have negative clips though, plus if you press tab for too long, it still takes more than 1, you could even make the delay longer, it takes more than 1 millisecond to reload in real time too
josh




PostPosted: Fri Feb 20, 2004 5:39 pm   Post subject: (No subject)

this looks like it's going to be a really neat game. Keep up the good work. (I really like the shotgun sounds)
Cervantes




PostPosted: Fri Feb 20, 2004 5:51 pm   Post subject: (No subject)

if you have turint 4.0.5 then you can use Input.Flush to clear the buffer.
I would definately use that over processes.

EDIT: or you could put a small delay in the if chars (KEY_TAB) part
Schaef




PostPosted: Sat Feb 21, 2004 8:13 pm   Post subject: (No subject)

wat kind of code could i use so that i can tell the program to do something once the gun is shot at a ball that i am going to make come onto the screen?
Schaef




PostPosted: Sat Feb 21, 2004 8:26 pm   Post subject: (No subject)

Right now I am using

code:
if buttonmoved("up") and whatdotcolor(cx,cy)=2 then  %2 is the colour of the ball.


but I have heard that watdotcolor is not a good method to use b4
Cervantes




PostPosted: Sat Feb 21, 2004 8:26 pm   Post subject: (No subject)

you can use an if statement.

code:

if mousex > ballx - ballradius and mousex < ballx + ballradius and mousey > bally - ballradius and mousey < bally + ballradius and mousebutton = 1 then


EDIT: if you know functions you could make your code a lot neater by putting that if statement into a function that returns true or false and then later calling the function.
Sponsor
Sponsor
Sponsor
sponsor
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 8 Posts ]
Jump to:   


Style:  
Search: