Collision Problem
Blitz3D Forums/Blitz3D Programming/Collision Problem
| ||
Hey Everyone, I am rather new to blitz3D i bought it a few weeks ago and i am having a strange collision problem... For some odd reason when the bullets collide with the enemy, the enemy doesn't disappear and the type does not get deleted... I been struggling and playing with this for a while, and i even had other people play with it for a while... I'm almost to the point now where i'm going to pull out all my hair out of my head because this isn't working... :-( Anyways here is an s/s of my game: and here is the source: http://www.razor.together4eva.com/SpaceInvader3D.zip I can really use some help here :-( Row 85 which is inside my updateAlien() function has the if entitycollided() information Rows 54, 293, 294 contain the EntityType commands Row 209 is the line that enables the collisions between the two entitytypes... Thanks again for helping me out and please excuse my poor modelling skills :-( i'm still practicing... |
| ||
Debuggin can be a pain. Try to isolate the bad guy one by one. I am rather sure it's a typo somewhere. Unlogical Errors are caused by typos most times. Please understand, not a lot of people like to go trough long codes of other people to find a bug. Edit: May also be it's a global/local thing. |
| ||
i looked at 2am, and expected a missing updateworld function, but because of the time, didnt get much farther than opening the file... Set debug mode to on, Have some debug variables in the global area of the code, and set them where you require.... Print them to screen just after renderworld This is another way to improve debugging, to have realtime info onscreen rather than looking down at the whizzing debuglog is quite useful. Cheers. |
| ||
Idaho I'm downloading now - not sure if I can be of any help but I will try. Ipete2. |
| ||
All right thx IPete2, i'm still trying what Cygnus and JFK told me to do (diff strats of debugging) i could use all the help i can get :-O thx again! |
| ||
Hmm. I am looking for clues here so I placed this code in around the 'Repeat' command. ;************* Collisions 2,1,1,2 Global peter=CreateCube() PositionEntity peter,0,0,-25 ScaleEntity peter,8,8,8 EntityColor peter,255,255,0 EntityType peter,1 EntityRadius peter,7 Repeat ;Begin Main Loop If EntityCollided(peter,2)=True Then EntityColor peter,Rnd(255),Rnd(255),Rnd(255) EndIf TurnEntity peter,0,1,0 ; Cls ;******************* AND change the following: EntityRadius b\sphere, 10 EntityRadius b\sphere2,10 In the bullet subroutine. This produces a Borg cube in front of you turning. interestingly the colour doesn't change but your bullets bounce off it. Showing the collision is working in one aspect - so check the aliens codes. btw I think you can get rid of the cls call too IPete2. |
| ||
Okay finally i'm seeing results... i changed entitycollided() to if entitydistance(b\sphere,i\alien) < 2 now the only problem is, is it crashes on me every now and then.. going to have to figure that out now... at least it works somewhat, and thx to everyone who helped me :-) |
| ||
uhhhh guys this is quite embarrassing to say but... my problem was my model wasn't positioned at 0,0,0 in my modeller.... I fixed it now and it works like a dream... sry guys for my stupidity and for wasting your time :-( |
| ||
KEWL It's great when you find the problem - that's half of what its all about for me - solving the problems. New demo soon plz then. lol! IPete2. |
| ||
hehe, i still need to add some stuff... it's kinda dull when you kill an enemy and he just disappears... So in my particle lib i'm coding a "explosion" particle function :-) so it is close and i will be releasing it soon! |