Simple Question involving Pointers

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

Simple Question involving Pointers

Postby Conqueran » Sun Aug 21, 2005 5:35 pm

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?
User avatar
Conqueran
 
Posts: 21
Joined: Fri Aug 19, 2005 4:55 pm
Score: 0 Give a positive score

Postby Conqueran » Mon Aug 22, 2005 12:38 am

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
User avatar
Conqueran
 
Posts: 21
Joined: Fri Aug 19, 2005 4:55 pm
Score: 0 Give a positive score

Postby BeyondtheTech » Mon Aug 22, 2005 1:12 am

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;
User avatar
BeyondtheTech
 
Posts: 270
Joined: Wed Mar 30, 2005 6:34 am
Location: Edison, NJ
Score: 4 Give a positive score

Postby makslane » Mon Aug 22, 2005 7:34 pm

To use the array returned by getAllActorsInCollision, use:
hitEnemy[0].x
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest