reload problem
Blitz3D Forums/Blitz3D Programming/reload problem
| ||
There is probably a better way to do this... But I wanted to try. I got a type for my quivers... this type holds the entity, x, y, z and amount in the quiver to reload the xbow. I put the quivers randomly for now, but I hope to create a map to put them later... this isn't the problem. the problem comes when I try to force a reload of the quiver. When I hot ONE of the quivers ALL quivers dissappear and I get ALL the bolts in EVERY quiver. This is how I handled the check. For a.reload = Each reload If EntityCollided(camera,8) Then moredude=a\ammoplus ammo = ammo + moredude FreeEntity a\entity Delete a.reload EndIf NextI am thinking I am probably going to have to go and repaste the quivers all over the map after one dissappears... but... what to do??? Does anyone know of a better way to handle this? -RZ |
| ||
Checking that you have actually collided with a\entity perhaps? If I understand correctly you are currently only checking if you have collided with any entity of that type. Consequently moving the entitycollided check outside the loop but also making use of the handle it returns, and using that to check inside the loop for a matching quiver. Or something like that, I have not done much with collisions recently, but have a look at the docs and you will get the picture. |
| ||
Yep, looks like you are doing what DJ said.If EntityCollided(camera,8) Then For a.reload = Each reload If CountCollisions(a\entity) > 0 ammo = ammo + a\ammoplus FreeEntity a\entity Delete a.reload EndIf Next EndIf |
| ||
OK I'm giving that a try...Wolron and DJ thanks... I get lost in loops ! :) |
| ||
No Joy!!! Nope... it didn't even work. The quiver just blocked the camera from moving. No extra bolts... slipping a hideentity in there did nada... If any more suggestions are out there??? How did some of you geniuses do it??? :) -RZ |
| ||
ummm did the camera collide or did something else ?? how is your player setup ?? a pivot with a camera and a sphere for the feet like I've seen in many FP samples ?? |
| ||
OK posting code: Its like that... the last function I just ;ed out for now 'cause I am trying to cheat and put the quivers when I check collisions... I did this in another game and it works fine. Doesn't work here though! -RZ |
| ||
you probably dont need both the 8,1 and 1,8 collisions -- use the one that detects the player hitting the quiver, then use EntityCollided to get the handle of the quiver just hit (saves scanning quivers) |
| ||
so I kill 8,1 and retain entitycollided... Hmmm OK I will try that. What I don't understand is that this works well in a much smaller game I wrote to learn about firing the gun at a target and hitting the target and returning data to create explosions when the target is hit. (out of breath) :] Rook |
| ||
hehehe I have no idea -- I'm doing a lotta guessing based on reading the docs and your code frags -- never tried anything like this :) I'm still working on getting my level management setup in place since all my game logic is going to base off that :) |