How to change and remove images

Hello!

I’m trying to develop a game wherein you connect “dots”/“nodes” on a grid, much like Flow.

The dots/nodes have a particular image when they are not connected and should change when they are.

Similarly, the paths start out as colouring the grid they pass through and turn into different images once the user has lifted his finger from dragging.

Any suggestions on how do I do this?

Note: I use a table for the grid which has this format but is actually just a 1d table:
5x5

 1 2 3 4 5  
 6 7 8 9 10  
11 12 13 14 15  
16 17 18 19 20  
21 22 23 24 25  

Basically the code looks like this:

for count = 1, dimensions do  
 for insideCount = 1,dimensions do  
 -- add grid squares  
  
 if (is\_node()) then  
 -- add initial node image  
 end   
  
 function action( e )  
 if (event.phase == "began") then  
 if (e.target.is\_\_already\_connected)  
 -- remove path images  
 -- revert node images to default images  
 end  
 end  
 if (event.phase == "ended") then  
 -- check which nodes are connected then change their images  
 -- check the paths from node to node, and change  
 end  
 end  
 grid:addEventListener("touch",action);  
....  
end  
  

So I’m kind of stumped on the changing and removing of images. Any help would be appreciated?

Regards,

John [import]uid: 186198 topic_id: 32352 reply_id: 332352[/import]

When I needed to change images on a display object, I used a sprite sheet with the images on and then when I needed to swap the image to moved the the next frame in the sheet.

Dave [import]uid: 117617 topic_id: 32352 reply_id: 128745[/import]

When I needed to change images on a display object, I used a sprite sheet with the images on and then when I needed to swap the image to moved the the next frame in the sheet.

Dave [import]uid: 117617 topic_id: 32352 reply_id: 128745[/import]

I agree with dave, but it sounds like in your case you may not need entirely new images. You could try using setFillColor and changing the color when the dot is selected.

Scott [import]uid: 59735 topic_id: 32352 reply_id: 128921[/import]

I agree with dave, but it sounds like in your case you may not need entirely new images. You could try using setFillColor and changing the color when the dot is selected.

Scott [import]uid: 59735 topic_id: 32352 reply_id: 128921[/import]