This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2008-12-16 01:33:43

Inkstand
Scratcher
Registered: 2008-12-16
Posts: 23

Scratch Help! Formula problem

I'm (trying) to make a Guitar Hero kinda game, but I have hit a small problem. I have a variable beat going, but I need something to happen every forth beat starting from 3. Any ideas? I could be going about it the wrong way. Help!


"To say of what is that it is not, or of what is not that it is, is false, while to sat of what is that it is, and of what is not that it is not, is true." - Aristotle
"I don't apologize. I'm sorry, but that's just the way I am."  - Homer Simpson

Offline

 

#2 2008-12-16 05:27:29

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Scratch Help! Formula problem

The Mod function is very useful for that sort of thing.  It returns the remainder of the first number divided by the second number.  So if you have a count of the beats in a variable called "Beats" then you could do something like this:

[blocks]
<if><( (( <{  Beats   }> <mod> 4 )) <=> 0 )>

      do stuff

<end>
[/blocks]


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#3 2008-12-17 00:39:45

Inkstand
Scratcher
Registered: 2008-12-16
Posts: 23

Re: Scratch Help! Formula problem

Great thanks!


"To say of what is that it is not, or of what is not that it is, is false, while to sat of what is that it is, and of what is not that it is not, is true." - Aristotle
"I don't apologize. I'm sorry, but that's just the way I am."  - Homer Simpson

Offline

 

Board footer