bounce not working....
Blitz3D Forums/Blitz3D Beginners Area/bounce not working....
| ||
i need this code to allow the user when in the air (p\Motion\Ground = False), to press the b action button, and send them shooting towards the ground at a given gravity, then when they hit the ground, send them back up into the air at a given gravity, and allow for this multiple times as long as the bubble shield is on and "me" isnt in the roll, homing attack, boost, or jump mode. think of it as a basketball. |
| ||
p\Action <> ACTION_JUMP Or p\Action <> ACTION_HOMING Or p\Action <> ACTION_BOOST Or p\Action <> ACTION_ROLL if i am "anything but a cat" OR "anything but a dog"? If i was indeed a cat then i am of course "anything but a dog". If i were a dog i would pass through that, because i am "anything but a cat". In fact even if i were a fish i would qualify too as this statement is ALWAYS true ;) |
| ||
im not a government agent, d4nm4n -.- LOL |
| ||
basically if you are jumping you are not doing homing and if you are homing you are not jumping. this operator <> means "not equal to" or "ANYTHING but".(!= in most languages) and you are saying -OR- |
| ||
d4nm4n, i updated the code. which works HALF WAY.... >< whats wrong? |
| ||
try the AND op instead :P If you are doing something other than jumping AND something other than homing |
| ||
i basically need player to be able to shoot down to the ground if he's in the air when hitting the actionb button, and not doing any of the p\Action's, and when he hits the ground bounce him back up once, adding a little less gravity to him each time, allowing him to jump higher 3 times, then stopping the gravity from allowing him to jump higher the 4th time and > 4th. |
| ||
ok, here's what i have. i COMPLETELY redid code. what is WRONG with this. when he collides w/ the ground, and bounce should = 1. which it does. then when bounce = 1, count should add 1 for every bounce he makes.... count is still = to 0. what is wrong w/ this code? |
| ||
You haven't posted your full code (for obvious reasons). There may be something you've done wrong in the rest that impacts on this. I cannot be sure if this is the problem, but when do you call UpdateWorld? This probably isn't the problem, but it is something you should check and keep aware of - none of your collisions will register unless you have called UpdateWorld beforehand, and also collisions found from the previous call will be lost when you call UpdateWorld. |
| ||
If count never updates then you should focus on this:;when he hits ground and bounce = 1 If EntityCollided(p\Objects\Entity, COLLISION_WORLD_POLYGON_ALIGN) And bounce = 1 count = count + 1 EndIf EntityCollided does not return True/False. It returns an entity handle. This will be an even number. The least significant bit is always 0. That means the condition becomes (Even number) And (bounce=1). This is always 0, so count = count + 1 is never reached. You should use EntityCollided( something ) <> 0 as the first part of the test. The point of all this is that the Blitz3D And operator is ALWAYS bitwise. That's not at all clear from the documentation. The same is true of Or/Xor. If you want to use them as a logical operators then be sure both operands are True/False. |
| ||
i call it before update world |
| ||
ok, this code SORTA works. the prob is instead of u hitting actionb while in the air, and him bouncing back up one time a little higher each jump for the next 3 counts, he does it infinitely after u hit the actionb. |
| ||
still is only 1/2 way working.. |
| ||
still cant get bounce to work... |
| ||
bounce fixed! |