Ok i'm back... with a little problem on my drag racing game
Author |
Message |
dark_knight_97
|
Posted: Sat Sep 21, 2002 6:22 pm Post subject: Ok i'm back... with a little problem on my drag racing game |
|
|
i have my rpm gauge using sprites.. works fine, but it seems to jump up and down... maybe i need to cls everytime or something, but that might slow it down... anyways any help there would be good.
also my rpm count seems to want to go up and not come down, like u know when u let ur foot off the gas, my thing will rpm ill go up but it needs to come back down at the same ratio. I've tried different things but all i would get is say if
rpm = rpm +100
blah blah code
rpm = rpm - 100
it would all just stay the same and nothing would happen. any help here would be good thanks... |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Sun Sep 22, 2002 5:16 am Post subject: (No subject) |
|
|
I don't really understand what you mean by jumping sprites... You'd have to explain that part.
Now about your RPM issue. My guess is that it both adds and subtracts the values, so it stays the same. Your code should be in this format:
code: | var accelerate : boolean := true
%USER INPUT HERE%
%if accelerate button is held down, then accelerate = true, else
%accelerate = false
%RPM calculation here%
If accelerate = true
then
RPM := RPM + 100
else
RPM := RPM - 100
end if
|
Here's how to determine if sertain key is HELD down (not just pressed once)
code: | Input.KeyDown (var chars : array char of boolean) |
this procedure will check for all they keys down and assign them to the chars array. Note that the array is boolean type, so the values assigned are ether true or false.
Sample code:
code: | var chars : array char of boolean
Input.KeyDown (chars)
if chars ('t') then
put "The T key is pressed"
end if |
Note: amout of keys detectable at a time is hardware dependant. Keyboard can detect a minimum of 2 keys + Shift + Alt + Ctrl. More if you got a better keyboard. I know for a fact that it can detect all 4 arrow keys pressed down at same time.
Good luck with your game. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
dark_knight_97
|
Posted: Sun Sep 22, 2002 9:21 am Post subject: It still doesn't work |
|
|
This helped me a little but it still wont come back down. The input keydown thing always gives me an error saying keydown is not in the export list of input.
The jumping sprites thing is when i have my rpm gauge going up the whole window seems to shake like your actually inside a car. Its actually kind of cool, but you get kind of dizzy after a while so I think i should try to shut it off because i might give some of my family members epilepsy or something. I dont know how to describe it. It only started happening since I put in the rpm gauge. Wierd. Anyways any help would be great thanks. |
|
|
|
|
|
Dan
|
Posted: Sun Sep 22, 2002 9:47 am Post subject: Input.KeyDown |
|
|
i think you get an error for Input.KeyDown becuse you have an older version of turing. Input.KeyDown is in turing 4.0.1, if you have turing 4.0.0 there is a free updata on holths site.
also it may help if you where to post or send your code to one of us so ew coude better undsatnd what is going on in your game. |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
dark_knight_97
|
Posted: Sun Sep 22, 2002 12:51 pm Post subject: I have 3.1a |
|
|
I have 3.1, but 4.0.1 doesn't support sprites does it? |
|
|
|
|
|
Tony
|
Posted: Sun Sep 22, 2002 1:54 pm Post subject: (No subject) |
|
|
no, 4.0.1 (or is it .3 now?) does support sprites. Not yet atleast. And it can't compile.
Though you can use Pic.Draw with mode set to picMerge. This will make white color transparent so it will be just like sprite. Though you would hate to clear the screen before moving any of them.
I think I can write up a procedure to make sprites available for 4.0.x, but not right now... I got a biology test tomorrow. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|