Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK .NET / Help with a collection of sprites

Author
Message
aerostudios
14
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 2nd Nov 2012 23:23 Edited at: 2nd Nov 2012 23:25
@jojoofu

Okay, I'm trying to do something with my UI and sprites. What I've created, are red and green lights, 2d images that indicate on/off. I've created a bank of 14 horizontal sprites that present it like a bank of lights. What I want to happen, is the user can click on a light and it changes a visible image. These lights are acting as page markers.

I've loaded these images into a collection. Using a sprite collision, I can retrieve the index in the collection of the sprite that was clicked. Now, I need to swap out the sprite image to turn the selected light ON, and set the existing light that is on to OFF; which can be any of them.

GreenButtons () is a collection of Sprites
GreenOnButton is an image

I've tried using ;

GreenButtons(Index).image = GreenOnButton

This doesn't seem to work. Although, when I first create the collection, I use this command in this form to set the first light to be on and it worked. So, I don't know it doesn't work later when the correct index value is being returned.
aerostudios
14
Years of Service
User Offline
Joined: 20th May 2009
Location: Oklahoma City OK (USA)
Posted: 3rd Nov 2012 00:54
Never mind, I figured it out.

My Select Case condition was a syntax error:

I had;

Select Case Collision
Case 1 - 15

instead of;

Case 1 to 15

that was the problem.

Login to post a reply

Server time is: 2024-03-28 08:43:11
Your offset time is: 2024-03-28 08:43:11