x


How to stop Input?

First of all, why I am trying to do this:

I have a script that cause the player to play an animation (for making something on the ground) and then a campfire appears. The trigger right now is pressing the spacebar (this will be changed in the future).

The problem here is that if the person keeps pressing the spacebar, they make tons of campfires from just one animation.

So I want to say that the game will ignore the spacebar input from the start of the campfire animation until the end.

Is this possible? Do you have a better solution to my problem?

My current version is available here: http://www.mythstrott.webs.com/mythstrott.html Note on the current version, I have fixed the glitch where you can walk around in the middle of making campfires. I just haven't updated that on the site yet.

Thanks for any help!

more ▼

asked Aug 03 '10 at 05:56 PM

MythStrott gravatar image

MythStrott
176 22 23 31

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

Just use a flag in your script to check, and use animation events to trigger the flag on and off. This is pseudocode, it should be something like this:

bool canBuild;

Input/Update:
    if canBuild:
        build campfire;

function startBuilding:
    canBuild = false;

function stopBuilding:
    canBuild = true;

Then use an Animation Event to trigger the start/stopBuilding functions so it only happens if it's not already happening.

more ▼

answered Aug 03 '10 at 06:03 PM

qJake gravatar image

qJake
11.6k 43 78 161

Thanks. It took a bit of thinking, but I got it to work.

Aug 03 '10 at 06:20 PM MythStrott
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3798
x3461
x956
x152
x105

asked: Aug 03 '10 at 05:56 PM

Seen: 1616 times

Last Updated: Aug 03 '10 at 05:56 PM