B
bob97470
Guest
Encountering a strange issue in regards to image_index. problem is reproduceable.
create new project
create sprite and resize to 96x128. (resizing may not be necessary)
create 29 frames and draw the numbers 0 through 28 in them. (drawing the numbers is not necessary, but helpful to see results)
create object and assign the sprite to it.
drop object in room.
create press key event for the object and try any of the following
image_index = 15; //this shows sub image 14, consequently setting it to 14 also shows 14 and setting it to 16 shows 16, but 15 will not show 15
or
image_index++; //count your way up as you press the key and notice that sub image 14 shows twice in a row, that doesnt sound right.
or
image_index = 15.01; //this actually shows the correct sub image.
you can also create a draw event like
draw_self();
draw_text(x+10,y+10,string(image_index));
this will of course show the image_index in the corner of the sprite as you cycle through them. I noticed that once it gets to 15 it changes from an integer to a decimal. displaying 15.00 , but sub image is still 14.
If anyone can explain why this is happening I would appreciate it.
create new project
create sprite and resize to 96x128. (resizing may not be necessary)
create 29 frames and draw the numbers 0 through 28 in them. (drawing the numbers is not necessary, but helpful to see results)
create object and assign the sprite to it.
drop object in room.
create press key event for the object and try any of the following
image_index = 15; //this shows sub image 14, consequently setting it to 14 also shows 14 and setting it to 16 shows 16, but 15 will not show 15
or
image_index++; //count your way up as you press the key and notice that sub image 14 shows twice in a row, that doesnt sound right.
or
image_index = 15.01; //this actually shows the correct sub image.
you can also create a draw event like
draw_self();
draw_text(x+10,y+10,string(image_index));
this will of course show the image_index in the corner of the sprite as you cycle through them. I noticed that once it gets to 15 it changes from an integer to a decimal. displaying 15.00 , but sub image is still 14.
If anyone can explain why this is happening I would appreciate it.