Posted: 1st Feb 2022 20:34
So I am trying this the easy way,

Instead of creating 20 different text objects I am doing this

The problem is They do not have text numbers or names so i can not change there numbers. there all number 1

all I need is for each text to be a different number, they do nothing but sit there.

+ Code Snippet
x_pos=9
y_pos=6

for x=1 to 20
level_select_text=createtext("1")
SetTextSize(level_select_text,10)
SettextPosition(level_select_text,x_pos,y_pos)
FixTextToScreen ( level_select_text, 1 )
SetTextColorAlpha ( level_select_text, 255 )
SetTextFontImage(level_select_text,font)
SetTextDepth(level_select_text,0)
SetTextVisible(level_select_text,1)

inc x_pos,20

if x=5
x_pos=9
inc y_pos,25
endif

if x=10
x_pos=9
inc y_pos,25
endif	
	
if x=15
x_pos=9
inc y_pos,25
endif		
	
next x
Posted: 1st Feb 2022 20:45
You really need to put your text objects in an array so that you can access each of them later.
Doing it your way, you won't be able to delete the text once the level selection is complete
Posted: 1st Feb 2022 20:47
Scraggle

Ok, that was what I was thinking but had to make sure

Thank you
Posted: 1st Feb 2022 20:59
You're also making a lot of work for yourself with those IF's
Try this:
+ Code Snippet
counter = 0
level_select_text as integer[23]
for y = 6 to 81 step 25
	for x = 9 to 109 step 20
		level_select_text[counter] = CreateText(str(counter+1))
		SetTextSize(level_select_text[counter],10)
		SettextPosition(level_select_text[counter],x, y)
		FixTextToScreen ( level_select_text[counter], 1 )
		SetTextColorAlpha ( level_select_text[counter], 255 )
		SetTextFontImage(level_select_text[counter],font)
		SetTextDepth(level_select_text[counter],0)
		SetTextVisible(level_select_text[counter],1)
		inc counter
	next x
next y
Posted: 1st Feb 2022 22:06
Scraggle

I know, this is why I was asking, I knew there was a better way I just could not figure it out.

This worked just right

I had to adjust the numbers around a bit but it works good,

thank you.
Posted: 2nd Feb 2022 10:29


Ok so I loaded my images in the same way and it took awhile to figure out but my level select screen is working very well.

I see how I can make arrays for many items the easy way.

What I mean is I have been making empty arrays with types and this works perfect.

But the way you showed me is a easy way for a fast easy setup for arrays.

I have made arrays like this before, but in a backward thinking and not for like.

for x=1 to 30
make something
next x

but you unconfused me so I thank you.

Also doing long code and shorting it with step values I never understood till I played with it and now I know how to use step, in theory.
.