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.

DarkBASIC Professional Discussion / reloading and firing problems

Author
Message
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 23rd Jan 2011 20:28
So I decided to work on an old FPS project again and have run into the same problem: my shotgun unloads a whole clip in about a second and the reload animation doesn't work. The conclusion I came to is this: I use functions to handle most things for the program. So, when I use timers like this:


and this code works fine if i place the code in the main DO...LOOP but if I put it in the a function to just check every loop to look cleaner and be able to fix easier, it has no delay with the shoot. Any thoughts?

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Jan 2011 20:33 Edited at: 23rd Jan 2011 20:36
Quote: "to look cleaner and be able to fix easier"

Can´t you put it in a label instead of a function ?


Cheers.



I'm not a grumpy grandpa
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 23rd Jan 2011 21:19
what do you mean, like this?



chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Jan 2011 21:22 Edited at: 23rd Jan 2011 21:24
Yep ! that´s it



I'm not a grumpy grandpa
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 23rd Jan 2011 21:28 Edited at: 23rd Jan 2011 21:29
oh and my other question is about my reloading. I can reload but when I reload, it stops the whole program while it runs the reload animation and only plays it once. Here is the code (NOTE: this is also a function that is called when I need it)



edit: okay, I'll try that then

Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 23rd Jan 2011 21:41 Edited at: 23rd Jan 2011 21:42
so the label worked for the shooting, thank you! As for the reloading, I'm still not sure what to do...I even tried putting it in a label and in the main loop but nothing worked...

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 23rd Jan 2011 21:51
You can use function aswell .You can have all animation on the same file, and then play object from star_frame to end_frame when you call the function.

Cheers.



I'm not a grumpy grandpa
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 23rd Jan 2011 21:58
The animation is all in one model file but I want to reload only as much as I need to (such as if I have only two shells to reload, loop through twice). This is a shotgun I'm trying to loop by the way.

chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 24th Jan 2011 00:18
That is what I meant...if you have a soldat with 300 frames, and your soldat runs from frame 20 to 40, every time you want your soldat to run, you will have to loop the animation from 20 to 40:



Good luck.

I'm not a grumpy grandpa
Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 24th Jan 2011 16:05 Edited at: 24th Jan 2011 16:06
Yeah, I got that part. I have changed the code slightly so now it loops and the reload code is a label in the actual reload command as oppose to the animation command. There is still a problem though, the animation freezes right at the start of the reload. here's my code:



NOTE: the function is called as needed. The label keyboard_reload is called every loop of the main loop. Also, the variables (such as reload) are global

Any ideas as to why?

Derekioh
17
Years of Service
User Offline
Joined: 1st Feb 2009
Location:
Posted: 26th Jan 2011 17:03
Please, can someone help?

Login to post a reply

Server time is: 2026-07-16 12:19:58
Your offset time is: 2026-07-16 12:19:58