Help creating a reload for a gun :D

For questions about using Classic.

Post » Sat Jun 19, 2010 8:52 pm

I'm making a simple shotgun and everything's gone great,
I just have 1 little issue at the moment,
I have it set to when the shotgun shoots it sets P variable R to 1.
When R is set to 1, I want to make it wait X seconds before switching back to 0.

For some reason I cant find a time set up like that that isn't in form of a condition..

Help would highly be appreciated!
B
2
S
2
G
3
Posts: 140
Reputation: 1,530

Post » Sat Jun 19, 2010 9:05 pm

Add a "Wait" object to your project. If you can't see the "wait" object, make sure that you have the latest build of Construct.

Afterwards, just call the "wait" object inside the event sheet, then select "aWaitDelay"

This should help you in placing a delay in your game.

Hope this helps.
B
3
S
1
G
2
Posts: 86
Reputation: 997

Post » Sat Jun 19, 2010 9:15 pm

Oh!
I never would have thought to check out the object :P

Edit:
When I use this,
It works perfect the first shot,
then the rest go back to rapid fire..
any clues to why it does that?
B
2
S
2
G
3
Posts: 140
Reputation: 1,530

Post » Sat Jun 19, 2010 10:08 pm

Hmm... That's weird. It should work. You must have placed the delay somewhere that it isn't called again. Check the flow of your code and see if it passes through the function with your delay the second time around.

Tip: Check if your conditional is met. You might have forgotten to re-set a value to meet the condition.
B
3
S
1
G
2
Posts: 86
Reputation: 997

Post » Sun Jun 20, 2010 2:43 am

Use the timer behavior.

Here's an example to illustrate:
http://dl.dropbox.com/u/5426011/example ... xample.cap
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Sun Jun 20, 2010 10:35 am

I love this forum :P
Thanks a lot hound!
B
2
S
2
G
3
Posts: 140
Reputation: 1,530

Post » Sun Jun 20, 2010 8:15 pm

Ehh why not just use every x milliseconds? From what I've heard it's the simplest answer. Just have when button down & every (lets say 500) MS > shoot
That way you can shoot 2 times a sec and if you want slower just increase the millisecond count or so.
B
11
S
3
G
4
Posts: 622
Reputation: 3,186

Post » Sun Jun 20, 2010 8:51 pm

Sagal's right, just use the "every" condition, much simpler. I compared the two methods and found that they behaved pretty much the same. I'm continuously impressed on how so many tasks are very simple to do in construct.
B
79
S
24
G
54
Posts: 4,749
Reputation: 40,761

Post » Sun Jun 20, 2010 8:54 pm

Yes, I was going to propose to use the every x milliseconds too, but kithief said he wasn't looking for a method that isn't a condition.

@Rojohound, I agree. Construct <3
B
3
S
1
G
2
Posts: 86
Reputation: 997

Post » Sun Jun 20, 2010 9:04 pm

Ohhh good idea!
much appreciated :D
B
2
S
2
G
3
Posts: 140
Reputation: 1,530

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: Yahoo [Bot] and 0 guests