Why letters appear in reversed order ? ,Letters appear in reversed order

Hello,

I’m building a game where player have to draw a path between some letters to make a word. The problem is that the letter appears in reversed order of the path.

Things I tried:

  • changing for-loop to :

    for(int i = (offeredLetters.Count- 1); i >= 0; i–) // Nothing change

*tried foreach

I appreciate any help.

The image below show the problem.
![alt text][1]

Here is my code:

public void CreateOfferedLetters()
{
    float alpha = 360f / (offeredLetters.Count + offeredBonusLetters.Count);
    float firstAngle = 0;
    Vector3 startPosition = new Vector3(0, 250f, 0);

    for (int i = 0; i < offeredLetters.Count; i++)
    {
        GameObject letter = Instantiate(offeredLetterPrefab, offeredLettersHolder.transform) as GameObject;

        letter.transform.Find("AnimationHolder/LetterHolder").GetComponent<OfferedLetter>().letter = offeredLetters*;*

letter.transform.Find(“AnimationHolder/LetterHolder/LetterImage”).GetComponent().sprite = GetLetterSprite(offeredLetters*);*
letter.transform.localScale = Vector3.one;
letter.transform.localPosition = Vector3.zero;

Quaternion r = letter.transform.rotation;
r.eulerAngles = new Vector3(0, 0, firstAngle);
letter.transform.rotation = r;

Quaternion l = letter.transform.Find(“AnimationHolder/LetterHolder”).localRotation;
l.eulerAngles = new Vector3(0, 0, -firstAngle);
letter.transform.Find(“AnimationHolder/LetterHolder”).localRotation = l;

firstAngle += alpha;

// Create a selection letter
GameObject sl = Instantiate(selectedLetter, selectedLettersHolder.transform) as GameObject;
sl.GetComponent().sprite = GetLetterSprite(offeredLetters*);*
sl.transform.localScale = Vector3.one;
sl.transform.localPosition = Vector3.zero;
sl.name = offeredLetters*;*
sl.SetActive(false);

}
_*[1]: http://techwalkers.net/letters.png*_

Technically, you aren’t printing the numbers in ‘reverse’, you are printing them in ascending order. What you want IS to print them in reverse.

What you had attempted before is correct, but you have a syntax error, you have a random ‘.’ after .Count. Replace your for loop with the following and it should work like you want:

for (int i = offeredLetters.Count - 1; i >= 0; i--)

The fact that nothing changed when you reversed the order is not normal. What type is offeredLetters?

@AbdoQum try reversing the list with Linq :

var reversed = offeredLetters.Reverse();

then using reversed when retrieving letters.

Edit : @AbdoQum : somehow comments can’t handle special characters. I’m tyring to write the right way to call Reverse :

var rev = offeredLetters.Reverse<string>();