Random(0,1) returns a random floating point value between 0 and 1. You might want to try choose(0, 1).
How many parameters do you call your function with ? The Param collection is 0-indexed and you are using "Param(1)", is it intended ?
You can use this. However, keep in mind that any user can modify their system clock at will and thus, "cheat". Using an external source to fetch time is recommanded for such games, but this require an active internet connection.
Yeah, that's two basic features that should be readily available to the text box... Maybe Ashley will find time to add them in the near future. <img src="smileys/smiley9.gif" border="0" align="middle" />
Anyway, as you see, we can easily do without ! <img src="smileys/smiley1.gif" border="0" align="middle" />
You could try to use a text box object set to "textarea" and readonly. With a bit of javascript you can make the text box to autoscroll to bottom. See an example here.
You'll have to use a local variable for that, or do the inversion yourself everytime you use the loopindex. If your "step" is -1, I'd use the second method.
For x = 0 to upperBound
---Set variable to upperBound - loopindex
Yup, you got it right ! I just re-uploaded the example with the implementation of such a ratio.
Leftmost and rightmost positions are respectively at cycle position 0.25 and 0.75. You could use this information to modify the magnitude at will, however, cycle position can't really be tested with such fixed values. You need to test greater than/lesser than and use a boolean to switch the active condition. Second, magnitude shouldn't be changed at those moments, because it'll totally break the behavior... (I just tried <img src="smileys/smiley18.gif" border="0" align="middle">) BUT ! Changing the magnitude at cycle time 0 and 0.5 (when the sprite is centered) should do what you want.
Here's the result : http://www.freewebs.com/johnwof/newRandomMagnitude.capx
A simple reversal of the cos and sin will do the trick.
VectorX = ImpulseStrength * -cos(Angle)
VectorY = ImpulseStrength * -sin(Angle)
Where ImpulseStrength is an arbitrary value of how powerful the recoil will be.
Develop games in your browser. Powerful, performant & highly capable.
Or go for some overkill expression :
choose(Sprite.Angle = 0 ? choose(90, 180, 270) : 0, Sprite.Angle = 90 ? choose(0, 180, 270) : 90, Sprite.Angle = 180 ? choose(0, 90, 270) : 180, Sprite.Angle = 270 ? choose(0, 90, 180) : 270)
<img src="smileys/smiley36.gif" border="0" align="middle" />
What we need is a sprite condition like "is (x,y) in collision polygon of object A" or a system condition like "is (x,y) solid".
Logical operators return 0 or 1, and this include the = operator (not "=="). So you could do it this way :
First Value: Score % x = 0
Comparison: =
Second value: 1
Member since 4 Jul, 2011