Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Deleting Items from a list mid-game
Old
MayhemGames
Guest
 
Status:
Posts: n/a
Default Deleting Items from a list mid-game - 04-08-2010, 08:41 AM

Hello all,

I am currently working on a project for class in which I am recreating the memory card game concentration, where you have to remember the locations of certain items and match them with the identical one.

The way I am doing this is having two lists, remainingSquares and remainingTextures. When spacebar is pressed for a new game, it distributes a random texture to each square. However, the problem I am having is repeats.

In my case, I am having two differently-named items that correspond, such as baseball-1 and baseball-2, that correspond and will match. baseball-1 can be distributed to ONE SQUARE ONLY, but since the squares are being given a random texture from the available textures list, I need a way to delete, permanently delete, an object from a list mid-game.

If anyone knows how to permanently delete an object(s) from a list while the program is running, it is much appreciated!
   
Reply With Quote
Old
bjia56
Guest
 
Status:
Posts: n/a
Default 04-08-2010, 10:27 AM

I'm not sure if this will entirely solve your problem, or if it will work 100%, but here it is:

You could try to have a variable and pick random integers from 0 to that variable minus one for the lists, then after each random selection do "remove item from (index) of list" and place that random number in for index.

Sorry, was that a little too confusing? If so, I might be able to make an example world.
   
Reply With Quote
Old
MayhemGames
Guest
 
Status:
Posts: n/a
Default 04-09-2010, 08:33 AM

Thanks a lot, I think I know what you're talking about. But just to make sure, could you make that sample world? Thanks a lot, I appreciate it.
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 04-09-2010, 08:36 AM

Quote:
Originally Posted by MayhemGames View Post
Hello all,

I am currently working on a project for class in which I am recreating the memory card game concentration, where you have to remember the locations of certain items and match them with the identical one.

The way I am doing this is having two lists, remainingSquares and remainingTextures. When spacebar is pressed for a new game, it distributes a random texture to each square. However, the problem I am having is repeats.

In my case, I am having two differently-named items that correspond, such as baseball-1 and baseball-2, that correspond and will match. baseball-1 can be distributed to ONE SQUARE ONLY, but since the squares are being given a random texture from the available textures list, I need a way to delete, permanently delete, an object from a list mid-game.

If anyone knows how to permanently delete an object(s) from a list while the program is running, it is much appreciated!
From what i understand, there is no way to do that


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
bjia56
Guest
 
Status:
Posts: n/a
Default 04-09-2010, 08:49 AM

Ok, attached is the example world.

Somehow, the last element of my list is always selected last...

Let me know if there is something I should explain in the example.
Attached Files
File Type: a2w deleting element from list.a2w (2.89 MB, 20 views)
   
Reply With Quote
Old
bjia56
Guest
 
Status:
Posts: n/a
Default 04-09-2010, 08:49 AM

Quote:
Originally Posted by jediaction View Post
From what i understand, there is no way to do that
.........

Are you sure?
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 04-09-2010, 09:27 AM

no


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames
   
Reply With Quote
Old
bjia56
Guest
 
Status:
Posts: n/a
Default 04-09-2010, 09:47 AM

Ok so my example has deleting a list element while the program is running, but it does not permanently delete it, meaning that if you stop running the code and press the play button, it will still be there...

Is this what you were referring to as "cannot be done," jediaction?
   
Reply With Quote
Old
jediaction
Senior Member
 
jediaction's Avatar
 
Status: Offline
Posts: 5,064
Join Date: Jul 2009
Location: Bel Air, Maryland
Default 04-09-2010, 10:04 AM

uh im not sure. My problem was watching variables. Thats what you jsut said in your last comment?


Website: www.salokingames.com
FaceBook: www.facebook.com/SalokinGames

Last edited by jediaction; 04-09-2010 at 11:02 AM.
   
Reply With Quote
Old
bjia56
Guest
 
Status:
Posts: n/a
Default 04-09-2010, 01:24 PM

No, I don't think that was what I was referring to...
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2024, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.