The Daily Click ::. Forums ::. Klik Coding Help ::. Multiple objects of same type and alt. strings
 

Post Reply  Post Oekaki 
 

Posted By Message

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
12th February, 2010 at 16:20:28 -

Ok... The title of the post might be a bit vague but I hope it will become clear in a minute.

I have got some objects of the same type on screen that are created using a single fastloop and each object is assigned a different alt. string which is chosen at random from a list.

When the alt. string in question is entered into an edit box and enter is pressed, I want the correct object to be destroyed. At the moment all objects are being destroyed.

This is my code:

Number of balloons<=difficulty-1 (in this case difficulty=2)

-Start Fasloop "Balloons" 1 time

On Loop "Balloons"
-Create Balloon
-Position Balloon
-Set Line (word list) to random(number of lines(word list))+1 ----this is to negate the possibility of blank lines
-Set Alt String "word" to List Select$(word list)
-Delete Line List Select(word list)


This creates each balloon with their own unique alt. string (tested using the debugger)

The problem comes when destroying the object. Only one of them should match the typed word but they all go.

My code for destroying them:


Upon Pressing Enter
+EditText = word("Balloon")
-Destroy Balloon


Now I know I have to put something in there to identify the balloon in question but I don't know what or how.

Can anyone help me please???

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
12th February, 2010 at 16:41:11 -

Try comparing the balloon's string to the edit box instead of the other way around, so that the balloon is the focus object and not the editbox.

Other than that... try switching the order of the conditions in the last event?

 

  		
  		

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
12th February, 2010 at 16:48:23 -

Thanks for the ideas. Still doesn't work unfortunately. There must be a way to do it.....

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
12th February, 2010 at 17:06:06 -

Here's a way to do it. I added a step. String is equal to text box, set value to 1. Value is equal to 1 and enter is pressed, destroy.

http://jollycrouton.com/Uploads/games/lembi.zip

 

  		
  		

lembi2001



Registered
  01/04/2005
Points
  608

VIP MemberIt's-a me, Mario!Wii OwnerI like Aliens!Has Donated, Thank You!PS3 OwnerI am an April Fool
12th February, 2010 at 17:16:20 -

Thanks OMC!!! Works a treat!

 
n/a

OMC

What a goofball

Registered
  21/05/2007
Points
  3516

KlikCast Musician! Guy with a HatSomewhat CrazyARGH SignLikes TDCHas Donated, Thank You!Retired Admin
12th February, 2010 at 17:17:18 -

You are most welcome.

 

  		
  		
   

Post Reply



 



Advertisement

Worth A Click