Page 1 of 1

Simple Question involving Pointers

PostPosted: Sun Aug 21, 2005 5:35 pm
by Conqueran
This is a simple question that I've been trying to figure out for hours.

I want to change the x value of an actor that collides with my sword actor. Here's what I have.

int d;
Actor *hitEnemy=getAllActorsInCollision("Sword", &d);
hitEnemy[0]->x=50; //change x value of collided actor.


However when I compile I get "Pointer required" for line 3

I read everything I could about pointers online and I can't figure out what I'm doing wrong here. Does anyone know?

PostPosted: Mon Aug 22, 2005 12:38 am
by Conqueran
Maybe I should be a little more clear.
I have many actors in my game and
all I really want to do is change the INTERNAL DATA (x,y,yvelocity,etc) of the actor that my sword actor collides with.

I can do collision event for each individual actor of course but that would waste time and space. I want a way to target the collided actor (which can be almost anything) and change its internal data.

Thanks Alot

PostPosted: Mon Aug 22, 2005 1:12 am
by BeyondtheTech
Use the customized getclone2 feature (do a search).

You can read or change the internal value of any clone and use this command.

getclone2("hitEnemy",0)->x=50;

PostPosted: Mon Aug 22, 2005 7:34 pm
by makslane
To use the array returned by getAllActorsInCollision, use:
hitEnemy[0].x