Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Dexter
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Ohio
Posted: 15th Jan 2006 02:10
ok why wont this work or how do you get this to work...?

this is original code....


and this is what i wanna try to do with it...


ok the timer works and goes up 1 seconed at a time...
the problem is i cant get it to print HI when it hits 4 seconds...
do you guys know what im doin wrong or how to do it...?
thanx
Dexter

Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 15th Jan 2006 02:18
The timer() function returns values in Milliseconds. That is 1000th of a second.

Moreover the system timer() is started from when the computer is booted. It's not a DB/Dbpro thing. Hence, it'll never =4, it'll always be some huge number...


if you want to display a value after a 4 second delay. You need to wait 4 * 1000.

a bit like this



Uncle Sam
19
Years of Service
User Offline
Joined: 23rd Jul 2005
Location: West Coast, USA
Posted: 15th Jan 2006 06:35
Or something like this ...



Should work either way.

--------------
Uncle Sam
Dexter
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Ohio
Posted: 15th Jan 2006 07:07 Edited at: 15th Jan 2006 07:08
ok using uwdesign's idea...
I have this....

compiles successful but when i run it it says bob out of place or something like that...

all I want it to do is when that timer hits a certin second i want that sprite to appear and then it will move once on there...

thanx guys

*edit*--forgot to put in my loop....
Dexter

Kevin Picone
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 15th Jan 2006 07:37 Edited at: 15th Jan 2006 07:43
Dexter,

Your re-assigning the value '1' in the compiler to Timer()+1000.. Which is possible in DB. While you can use numbers within variable names (eg MySprite1), it's illegal to re-assign them.

Ie.



So your getting the BOB doesn't exist error, because the sprite command isn't setting sprite "1" (as it might appear) rather it's setting whatever value "1" has been re-assigned.. Which will be some massive number!


To correct that, simply assign the end timer value to a legal Variable name. Something like this



master programmer
19
Years of Service
User Offline
Joined: 30th May 2005
Location: 3D Space
Posted: 15th Jan 2006 10:17
Also, when you have something that checks so see if it equals the timer, like if T = timer(), make sure to change that to if T=> timer() then have your +1000 or whatever. Using just the = won't cut it, because the timer() won't ever = T by that amount of seconds because the program loop occurs at different times, and on slower machines is messed up

UFO
19
Years of Service
User Offline
Joined: 11th Oct 2005
Location:
Posted: 15th Jan 2006 14:32
http://forum.thegamecreators.com/?m=forum_view&t=59347&b=7
TDK's timer tutorial


Hippopotomonstrosesquippedaliophobia-Fear of long words
Dexter
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Ohio
Posted: 15th Jan 2006 18:18
ok that works thank you... what im doing here if you guys didnt know is im making a Guitar Hero kind of game...
so I think a problem that may come up is notes dont always hit on the second...
could i do the math and figure out the half seconds too..

also my code for this is long and repetitive for this part... Is there a way to shorten this part of code?

see im goin for seconds to I hit the end of a song...
so that will go to like 350 some... 3:50 for this song...
any way to simplify it?
thanx
Dexter

Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 15th Jan 2006 18:48 Edited at: 15th Jan 2006 18:57
Actually, you could just store the times of the notes with an editor. When the notes play back they move down the screen whatever...You send them moving down the screen early, about five seconds early.

Then they collide with a ring, or sprite or something. just check for the collisions. You can tell from the collisions whether the player has pressed the button during a collision or not. That is much easier than working out all of the times. If it takes those blobs half a second to cross over the rings then that automatically give the player half a second to press their mouse button. You could even have an invisible sprite in the middle of the rings to use for collision detection, and an invisible sprite on the blobs too. This means that you can scale the sprite down to a single pixel if you want. A single pixel wouldn't give you long to press the mouse button during collision.

Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 16th Jan 2006 12:57 Edited at: 16th Jan 2006 13:07
I've been messing around, sort of making an editor. It seems best to have 5 buttons.. N,M,<,>,?

You press them in time to the music which then sends a blob up the screen. (This is an editor, not the game which moves down the screen), this stores a time in the correct DIM.

Dim red(100)
Dim Green(100)
Dim Blue(100)
Dim Yellow(100)
Dim Orange(100)

In its own DIM.


When the blobs go up the screen they will eventually reach a Y coordinate of your choice. Say....Y = 50.

Now if you make the distance in the editor, the same as the distance in the game you can find out how long this distance takes to reach. You take this time away from the time that you pressed the button.

Now during the actual game, the blobs will move away early.



When the music ends it is possible for the program to automatically save the Dim's to a file, because there is a music playing command of some sort. Can't remember all of DB's syntax without looking it up.

Here's a picture. You could display the times in the squares at the top, just to see if they look about right.



Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 16th Jan 2006 23:28
Quote: "When the music ends it is possible for the program to automatically save the Dim's to a file, because there is a music playing command of some sort. Can't remember all of DB's syntax without looking it up."


Yes. There are two commands that I personally love called "save array" and "load array". It reduces code down to one line for loading or saving an array of data and it gets rid of the need to delete the file you want to save before writing.

You can even put all those dims into one multi-dimensional array and save them all in one file.




Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 17th Jan 2006 01:13
You can put them in 1 dim if you want. I used seperate dims because it was easier to understand. Sort of self-remming.

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 17th Jan 2006 03:09
Ah ok.


Dexter
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Ohio
Posted: 17th Jan 2006 03:57
Not too bad boys... Not too bad...
No seriously this is lookin cool and Pincho Paxton's add on here has made this game take a new shape... I will post details and stuff when I actually have time to think and draw some stuff out... thanx for the support..
Dexter

Login to post a reply

Server time is: 2025-05-23 06:40:06
Your offset time is: 2025-05-23 06:40:06