Pages: 1
Topic closed
what is the best way to make a sprite fall when he isn't touching a color
Offline
If not touching color[something]
change y y -10!
Offline
[blocks]
<if><< <not> >><touching color[ somting
<point in direction( down
<move( 10 )steps>
Last edited by slayerrobe7 (2011-10-01 15:19:11)
Offline
if not touching color {something]
change y vel by -1
change y by y vel
else
set yvel to 0
end
Offline
i don't get what you are trying to say Imaginelt but i did this
https://docs.google.com/leaf?id=0B1Us-i … p;hl=en_US
but whenever i press up arrow it doesn't do anything neither does it change jumpvel
Last edited by rojasscratches (2011-10-02 09:44:03)
Offline
I think that you press up, and set jumpvel to 5, and immediately see that you are touching black and set your jumpvel back to zero.
Try this:
<when I receive[ start ]>
<set{ y-velocity }to( 0 )>
<forever>
<if><touching color[ green ]>
<set{ y-velocity }to( 0 )>
<if><key[ up arrow ]pressed?>
<set{ y-velocity }to( 5 )>
<end>
<else>
<change{ y-velocity }by( -0.4 )>
<end>
<change y by( <{ y-velocity }> )>
It will have a few glitches (for a better one see a platforming base (here's mine, I recommend it for two reasons shown below*). The main one I can see is that if there is no maximum on the y-velocity (or, rather, no minimum), the sprite can end up more than 5 deep in the color. However, the sprite won't be stuck, holding down the up arrow easily fixes it.
*1. it is mine
2. it requires no tinkering. It works with any size sprite, without sensing costumes or sensing sprites.
Last edited by MoreGamesNow (2011-10-02 10:15:39)
Offline
thanks so much MoreGamesNow you will get credit when i come out with my new game but I've always wondered what abs means and all that other stuff means and i see it a lot in other programs and the help screen doesn't tell me can you
Offline
The "abs" part is just for slope detection. I can rework it so it doesn't allow for slope detection if you want.
-----------------------------------------------------------------
abs = absolute value (distance from zero)
sqrt = square root of number
The next six are for trigonometry
ln means "natural log", or log in base e(2.71828...) instead of base ten.
log is short for "logarithm". Basically, it will find x when 10^x=(number you put in).
Last edited by MoreGamesNow (2011-10-02 20:43:08)
Offline
what does everything else stand for
Offline
Sine, Cosine and Tangent are based on the relationships of angles and sides of a right triangle (though their application is by no means restricted to a right triangle. Basically:
Sine of (angle x) = (the side opposite of angle x) / hypotenuse
Cosine of (angle x) = (the adjacent side of angle x) / hypotenuse
Tangent of (angle x) = (opposite side)/(adjacent side).
To continue this (very brief) foray into Trigonometry, there are two laws you should know:
Law of Sine
and Law of Cosine, which, following the triangle above, is:
(b^2) = (a^2)+(c^2)-(2ac(Cosine of B) ) if I remember correctly.
Last edited by MoreGamesNow (2011-10-02 22:06:09)
Offline
Topic closed
Pages: 1