Problem collecting cloned rings

Game Editor comments and discussion.

Problem collecting cloned rings

Postby beginnerirvaz » Thu Sep 22, 2011 12:57 am

hey everyone
Before I continue I just want to say thank you to everyone for helping me so far.
I'm at my next hurdle, I have created a ring actor for my player to collect. Each ring is worth 10 points and also shows in a ring counter on screen.
I thought I would be able to clone the ring and have my player collect, however once he collects the first it wipes out all the coins on screen and shows points and count for 1 ring.
Could somebody help me with this please?
Thanks
Irvaz
beginnerirvaz
 
Posts: 37
Joined: Fri Sep 09, 2011 2:02 am
Score: 0 Give a positive score

Re: Problem collecting cloned rings

Postby skydereign » Thu Sep 22, 2011 1:25 am

Most likely your code looks something like this.
player -> Collision with rings -> Script Editor
Code: Select all
score+=10;
DestroyActor("rings");

If so, you need to use "Collide Actor", instead of "rings".

If though the collision event belongs to the rings actor, then you need to use "Event Actor", instead of "rings".
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Problem collecting cloned rings

Postby beginnerirvaz » Thu Sep 22, 2011 10:26 am

Thank for replying.

I've done it this way -

Rings
Destroy actor - script -
Player.points+=10;

Destroy actor - script -
Player.ringCount+=1;

Points and ringCount being actor variables I have assigned a value of points=0 and ringCount=0 to my player

Both the score counter and ring counter textNumber are updated from those variables. I hope I'm making sense, sorry if not,
beginnerirvaz
 
Posts: 37
Joined: Fri Sep 09, 2011 2:02 am
Score: 0 Give a positive score

Re: Problem collecting cloned rings

Postby beginnerirvaz » Thu Sep 22, 2011 10:30 am

Sorry I just noticed my score counter does update with the correct amount of points it's only the ring counter that doesn't. I have 10 cloned rings, all collected and count shows 1.
Thanks
beginnerirvaz
 
Posts: 37
Joined: Fri Sep 09, 2011 2:02 am
Score: 0 Give a positive score

Re: Problem collecting cloned rings

Postby skydereign » Thu Sep 22, 2011 10:31 am

Well, I was talking about the collision code that actually destroys the actor, not the destroy actor event. But so you know, you can remove those two events, and put them into the collision code. Another note, it looks like you made two different destroy actor scripts for a single event. Try to avoid doing that, it makes things harder to look through.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Problem collecting cloned rings

Postby beginnerirvaz » Thu Sep 22, 2011 1:17 pm

I read your last post wrong, I did what you said and makes sense it works great now!
So could I put both those scripts in 1 destroy actor? Or both in player collision? What would be more efficient?
Thanks
Irvaz
beginnerirvaz
 
Posts: 37
Joined: Fri Sep 09, 2011 2:02 am
Score: 0 Give a positive score

Re: Problem collecting cloned rings

Postby Hblade » Thu Sep 22, 2011 2:19 pm

Rings - Collision - Any Side of Player
Code: Select all
score+=10;
DestroyActor("Event Actor");
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Problem collecting cloned rings

Postby beginnerirvaz » Thu Sep 22, 2011 4:39 pm

Hey, I've done what you said and altered my code so my rings and also my health restore items all now hold
Collision - any side of player - script
My ring script is -

Player.points+=10;
player.ringcount+=1;
DestroyActor("Event Actor");

I'm still a bit confused withy health restore items counter. The counter has
Draw actor - script-
textNumber = player.healthrestoreitem;

If the counter shows 3 items are held, I want to click the button next to the counter once to use 1 of those items. If an item is used the count should be reduced. If no items are held you can't click.

The item will do the following -
Player.hp+=10;

Thanks
Irvaz
beginnerirvaz
 
Posts: 37
Joined: Fri Sep 09, 2011 2:02 am
Score: 0 Give a positive score

Re: Problem collecting cloned rings

Postby skydereign » Thu Sep 22, 2011 11:11 pm

So you mean you want something like this?
items_counter -> Mouse Button Down - Script Editor
Code: Select all
if(player.healthrestoreitem>0)
{
    player.healthrestoreitem--;
    player.hp+=10;
}
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Problem collecting cloned rings

Postby beginnerirvaz » Fri Sep 23, 2011 7:09 pm

That worked perfectly! Thanks for that
beginnerirvaz
 
Posts: 37
Joined: Fri Sep 09, 2011 2:02 am
Score: 0 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest