Page 1 of 1

getAllActorInCollision and strcmp not working...

PostPosted: Sat Aug 14, 2010 1:30 am
by Game A Gogo
I'm having trouble with my code, I need to figure out if my actor is colliding with a certain actor with getAllActorInCollision and strcmp, but so far it doesn't work, I'm using the exemple provided in the documentation for getAllActorInCollision but the strcmp doesn't seem to work with it... here is the GED:
Collision.zip
(16.53 KiB) Downloaded 152 times

I'm sure someone will notice I'm trying to make my own physic engine of the sort, well yeah, and this is my idea by this strange bug seems to prevent me... perhaps this is another bug GE 1.4 has... I should try with 1.3.9 with similar code...
EDIT: Seems not to work in 1.3.9 either..

Thanks in case someone bothers

Re: getAllActorInCollision and strcmp not working...

PostPosted: Sat Aug 14, 2010 3:12 am
by DilloDude
Here's the problem:
Code: Select all
if(strcmp(actors[i].clonename,"TEMPlandTEMP")==0)

You're comparing clonename with the actor's name.
clonename includes the cloneindex, name doesn't.

Re: getAllActorInCollision and strcmp not working...

PostPosted: Sat Aug 14, 2010 11:39 am
by Game A Gogo
strangely I've been using "name" at first and it wasn't working.. I'll check my strcmp too

Re: getAllActorInCollision and strcmp not working...

PostPosted: Sat Aug 14, 2010 11:50 am
by Game A Gogo
Eh, the code is still not working... might be something else at this point
I'll keep on checking...
EDIT: I give up I tried everything I could think off, and yes I made sure that the MP_CollideMap[] doesn't reset itself after being true inside the loop and everything. -_-

Re: getAllActorInCollision and strcmp not working...

PostPosted: Sat Aug 14, 2010 4:18 pm
by jimmynewguy
Gogo, don't give up! You're still a genius to me and always will be, this is an excellent collision system.

I didn't know what "TEMPtopTEMP" was, so i didn't use that actor but i did my best to help you through this. Try this out and tell me if it's what you were looking for :) just tile "TEMPlandTEMP" and it should work fine this way

Re: getAllActorInCollision and strcmp not working...

PostPosted: Sat Aug 14, 2010 8:42 pm
by Game A Gogo
Thanks a lot and a point to you as well! This is one I though I wouldn't get out of.
the TEMPtopTEMP is suppose to be a top collide only land, the same collision detection will be placed in the top and bottom actors, to then be hidden and covered by an actor that will shoot in 360 degree angle :D

Again, Thanks a lot!

Re: getAllActorInCollision and strcmp not working...

PostPosted: Sat Aug 14, 2010 9:04 pm
by jimmynewguy
No problem :D but really thank makslane, i had the same issue using getAllActorsInCollision and he taught me to use NULL to reset the actors (or something along those lines), the only problem i really saw besides that was you didn't tell the actor to stop moving when colliding (you just disabled the actor from moving) hence the 2 else lines i placed setting the xvelocity to 0 :wink:

Besides, this is an excellent collision system. And for that I bow to you. I guess all my messing with platformer games paid off to someone! :P Too bad I haven't finished a good game of my own yet :(

I'm done rambling, good luck!

Re: getAllActorInCollision and strcmp not working...

PostPosted: Mon Aug 16, 2010 12:15 am
by Game A Gogo
to your effort here is the updated collision system (Took me a while to get it working!) this is the last source I release of this
r.zip
(26.24 KiB) Downloaded 150 times

Re: getAllActorInCollision and strcmp not working...

PostPosted: Mon Aug 16, 2010 3:00 am
by jimmynewguy
Nice :) The only thing i would have to say is to somehow distinguish the difference between where you collide with the walls and where you only collide with the top just to not confuse the player :D

Re: getAllActorInCollision and strcmp not working...

PostPosted: Mon Aug 16, 2010 1:13 pm
by Game A Gogo
I was thinking about making the actors darker (r=192;b=r;g=r;) for that purpose o:

also if you wonder why I named them TEMPxTEMP, the level should be generated from a file when I'm done with this :)

Re: getAllActorInCollision and strcmp not working...

PostPosted: Wed Aug 18, 2010 2:26 am
by Game A Gogo
Why does the collision system cease working when it's in collision with an actor that has it's collision state disable?? It's very annoying >_<

Seems like having a BG actor covering the whole screen (That would change color so it's not a plain color) will render the collision system useless...

EDIT: ooookay... reopened the ged just now and it worked fine o_o