charcter selection

how would i create something that would let me switch between images

Many, many different ways you could go on this one. One method would involve having all the images in a row ir grid, then when the player clicks one (selects it) it enlarges, or adds a border, etc. so that they can see which is currently selected. Though this would only work if you had a small number of options (as many as can fit on one screen at once). If you had more characters that can fit on the screen, you’d need to employ scrolling in some form.

Cheers,

Simon

Dixon Court Entertainment

how would i create the first method

Basically you would just display all the objects (images of the different character choices) on the screen, and add an event listener to each one. Those listeners all point to some characterSelection function. This function would set a variable to whichever character was selected, and then enlarge the object that was clicked (for example, using transition.to).

There would be a ‘Done’ or ‘Next’ button as well, and when they click this, it would return to the main menu, or continue to the game, or what have you, and the character selected variable would let the rest of your app know which character to use.

Cheers,

Simon

but how would you physically create the code

for selection

Physically? By typing it :stuck_out_tongue:

can i have an example of the code

Perhaps this will get you started:  https://coronalabs.com/blog/2013/11/26/tutorial-techniques-for-swapping-images/

Rob

Hi,

I don’t have an example of the code, as I’ve not implemented anything exactly like what you’re after. We’ve given you a couple of links, and some thoughts on how to approach the problem, so the best way forward is to have a go at what you want, and then come back and post on here with what you’ve done. Then we’ll be able to give specific tips and suggest edits to your code where/if you run into problems.

Good luck, and I look forward to seeing what you come up with!

Cheers,
Simon

the issue with the example is the 2 objects still collide

If the issue is you have two bodies colliding that you don’t want to collide, you should check out collision filtering. You can set different classes which only interact with the specific other classes you tell it to.

Cheers,

Simon

Many, many different ways you could go on this one. One method would involve having all the images in a row ir grid, then when the player clicks one (selects it) it enlarges, or adds a border, etc. so that they can see which is currently selected. Though this would only work if you had a small number of options (as many as can fit on one screen at once). If you had more characters that can fit on the screen, you’d need to employ scrolling in some form.

Cheers,

Simon

Dixon Court Entertainment

how would i create the first method

Basically you would just display all the objects (images of the different character choices) on the screen, and add an event listener to each one. Those listeners all point to some characterSelection function. This function would set a variable to whichever character was selected, and then enlarge the object that was clicked (for example, using transition.to).

There would be a ‘Done’ or ‘Next’ button as well, and when they click this, it would return to the main menu, or continue to the game, or what have you, and the character selected variable would let the rest of your app know which character to use.

Cheers,

Simon

but how would you physically create the code

for selection

Physically? By typing it :stuck_out_tongue:

can i have an example of the code

Perhaps this will get you started:  https://coronalabs.com/blog/2013/11/26/tutorial-techniques-for-swapping-images/

Rob