collide.MY new problem.(RESOLVED)

Non-platform specific questions.

collide.MY new problem.(RESOLVED)

Postby equinox » Tue Mar 10, 2009 4:48 pm

Hi at ALL,

when EROE_1 collide with PP (1 heart), the event..... does not work.

where wrong?

Tnk1000 x help.
Attachments
Image1.png
Last edited by equinox on Sun Mar 29, 2009 10:44 am, edited 2 times in total.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: collide.name problem.

Postby zygoth » Tue Mar 10, 2009 8:15 pm

I'm no expert, but I believe the best way would be to use the strcmp function which compares two strings and returns a variable based on the result. something like

if(strcmp(collide.name,"PP") ==1)ExitGame();

strcmp returns 1 if the strings are the same, 0 if not.
Can anybody else verify this? I don't think you can compare strings with mathematical symbols.
Hope this helps.

Zygo
Nova: 100% Vertigo/Mazeman: 100%
Visit my website to download them both! http://www.ketonegames.com
User avatar
zygoth
 
Posts: 140
Joined: Mon Jun 11, 2007 6:37 pm
Score: 5 Give a positive score

Re: collide.name problem.

Postby skydereign » Wed Mar 11, 2009 12:23 am

zygoth is right. But you can't use name, you would have to use clonename to make this work.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: collide.name problem.

Postby DST » Wed Mar 11, 2009 1:37 am

just use an integer. Save yourself a lot of trouble.

give each actor a unique id and class id on startup.

id=gid;
gid++;

and a class id
classid=5; //or whatever the appropriate number should be.

now just ask for collide.classid to know the TYPE of actor, or collide.id to know the unique id of the actor.

You can make an array to hold the names for the id's, and access that when you need the string for displaying.

Strings should not be an integral part of events; they are slow and bulky and computers hate them. Your computer hates you for using them. They should be only for display for the users.

Use numbers, I promise it'll make your life a lot easier.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: collide.name problem.

Postby equinox » Wed Mar 11, 2009 1:26 pm

Tnk ALL, for help me.

I use COLLIDE.NAME...and work!!

Now I try with getclone,,after with Id = 5.
Attachments
Image1.png
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: collide.name problem.

Postby equinox » Wed Mar 11, 2009 1:44 pm

if(strcmp(collide.name,"PP") == 0){
//ExitGame();
getclone("STAMPO.7")->textNumber = collide.cloneindex;<----work

...but...

DestroyActor("collide.cloneindex");<---- NO!!!
DestroyActor(collide.cloneindex);<---- NO!!! to destroy the heart with which the EROE collide.
DestroyActor("collide.name);<---- NO!!!

Please: where i wrong?

Tnk1000 for all help me.
Attachments
Image1.png
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: collide.name problem.

Postby skydereign » Wed Mar 11, 2009 11:45 pm

For this, just use destroy actor.
Code: Select all
DestroyActor("Collide Actor");
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: collide.name problem.

Postby equinox » Thu Mar 12, 2009 1:01 pm

Tnks. +1Point
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

collide.DO_HP == "HP +"<--not work

Postby equinox » Sun Mar 15, 2009 7:41 pm

HI,
DO_HP = 150; actor int var
DO_TIPO = "HP +" actor string var

hp = collide.DO_HO<--work....
..but..

if (collide.DO_TIPO == ""HP +){
.......
}..NOT.

Can help me,please?
Attachments
Image1.png
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: collide.MY new problem.

Postby skydereign » Sun Mar 15, 2009 7:47 pm

I think that is because that is an actor string variable.
Code: Select all
if (strcmp(collide.DO_TIPO,"HP +")
{
    //
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: collide.MY new problem.

Postby equinox » Sun Mar 15, 2009 7:52 pm

PERFECT!!!!!!!!!!!

many TNk1000 for yor kindley help me.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

(collide.name,ATTORE[0])<------#2 new problem.

Postby equinox » Fri Mar 27, 2009 7:17 pm

HI at ALL,

in create START:
Actor *ATTORE[3];
ATTORE[0] = CreateActor("EROE_1", "STOP_GIU", "(none)", "(none)", 160, 116, false);// Creo LEONE


in collision any actor for ENEMY:
if(strcmp(collide.name,ATTORE[0]) == 0){<---NOT WORK.
ExitGame();
}
..please: there is solution?

Tnk1000.
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: collide.MY new problem.

Postby makslane » Fri Mar 27, 2009 9:13 pm

You variable ATTORE is an actor, not a string.
Try:

Code: Select all
if(strcmp(collide.name,ATTORE[0].name) == 0)
{
  ExitGame();
}
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: collide.MY new problem.

Postby equinox » Sat Mar 28, 2009 11:13 am

...if(strcmp(collide.name,ATTORE[0].name) == 0)<--- error !!

if(strcmp(collide.name,ATTORE[0]->name) == 0){<---work...but collide with any ATTORE[0].n
Attachments
Image1.jpg
User avatar
equinox
 
Posts: 118
Joined: Tue Jan 29, 2008 3:38 pm
Score: 0 Give a positive score

Re: collide.MY new problem.

Postby skydereign » Sat Mar 28, 2009 6:21 pm

What do you mean with any ATTORE[0].n? Switching it to point to name should work, but it seems that is not what you want... ATTORE[0] points to an actor you have created, and is ATTORE not specific to your actor. The actor should correspond with the pointer, otherwise PP will collide and use ATTORE[0]'s information. I believe that is the problem, but you would need to change your approach to fix it. Can you explain what you are trying to do?
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron