getAllActorInCollision and strcmp not working...

You must understand the Game Editor concepts, before post here.

getAllActorInCollision and strcmp not working...

Postby Game A Gogo » Sat Aug 14, 2010 1:30 am

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 153 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
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: getAllActorInCollision and strcmp not working...

Postby DilloDude » Sat Aug 14, 2010 3:12 am

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.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: getAllActorInCollision and strcmp not working...

Postby Game A Gogo » Sat Aug 14, 2010 11:39 am

strangely I've been using "name" at first and it wasn't working.. I'll check my strcmp too
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: getAllActorInCollision and strcmp not working...

Postby Game A Gogo » Sat Aug 14, 2010 11:50 am

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. -_-
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: getAllActorInCollision and strcmp not working...

Postby jimmynewguy » Sat Aug 14, 2010 4:18 pm

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
Attachments
TEST2.zip
(16.74 KiB) Downloaded 139 times
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: getAllActorInCollision and strcmp not working...

Postby Game A Gogo » Sat Aug 14, 2010 8:42 pm

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!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: getAllActorInCollision and strcmp not working...

Postby jimmynewguy » Sat Aug 14, 2010 9:04 pm

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!
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: getAllActorInCollision and strcmp not working...

Postby Game A Gogo » Mon Aug 16, 2010 12:15 am

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 151 times
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: getAllActorInCollision and strcmp not working...

Postby jimmynewguy » Mon Aug 16, 2010 3:00 am

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
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: getAllActorInCollision and strcmp not working...

Postby Game A Gogo » Mon Aug 16, 2010 1:13 pm

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 :)
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: getAllActorInCollision and strcmp not working...

Postby Game A Gogo » Wed Aug 18, 2010 2:26 am

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
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest