• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Changing the Screen Size messes up my animation

  • 16
    Posts
    5
    Years
    • Seen May 1, 2023
    Hi, I have a little problem with my menu animation. The icons do a little animation when they are selected, however when i change the screen size in the options, they start to drift to the upper corner of the screen.
    I have no idea why this happens and tried some things myself but i cant seem to get it working. At the standard screen size everything works as intended.
    Would be really nice if anyone could help me wit this problem.
    Here is the code that handles the icon animation:
    Spoiler:
    Gif of the problem:
    Spoiler:

    Thank you in advance!
     
    The problem (I think) is that you made the place where the icon needs to float to as a set x and y so if the screen gets bigger the x and y you set are close to the top left. Maybe add a part checking the size of the screen?
     
    Never increment pixel positions (X, Y) by non integer values. The sprite resizer will not calculate those properly when changing screen resolutions. I think that your problem will go away once your position incrementing is done in integer intervals. Do a skip of the increment every 2 frames if you want to go half the distance (half as fast).
     
    Never increment pixel positions (X, Y) by non integer values. The sprite resizer will not calculate those properly when changing screen resolutions. I think that your problem will go away once your position incrementing is in integer intervals. Do a skip of the increment every 2 frames if you want to go half the distance (half as fast).

    That is what I said but makes a lot more sense 😅.
    Thanks Luka!
     
    Never increment pixel positions (X, Y) by non integer values. The sprite resizer will not calculate those properly when changing screen resolutions. I think that your problem will go away once your position incrementing is done in integer intervals. Do a skip of the increment every 2 frames if you want to go half the distance (half as fast).

    Holy shit it worked!! Thank you so much Luka. Will definitely keep this in mind next time.
     
    Also can you post this as a tutorial when it is done?

    Do you mean the fix or the menu itself? Luka's post was pretty much the fix. Just had to replace the 0.5px with 1px.
    The menu itself is a modified version of the bw2 menu. I have no experience whatsoever in coding so most of the process was just trying to understand the code and modifying pixel positions of the icons as well as deleting unnessecary blocks of code.
    I wont be posting the menu as a ressource because its for my own fangame but that was pretty much the process. Just trial and error most of the time.
    Besides, i think its cooler if everyone designs their menu by themselves so that we have a variety of cool looking menus, each one with their own little touch ;)
     
    Do you mean the fix or the menu itself? Luka's post was pretty much the fix. Just had to replace the 0.5px with 1px.
    The menu itself is a modified version of the bw2 menu. I have no experience whatsoever in coding so most of the process was just trying to understand the code and modifying pixel positions of the icons as well as deleting unnessecary blocks of code.
    I wont be posting the menu as a ressource because its for my own fangame but that was pretty much the process. Just trial and error most of the time.
    Besides, i think its cooler if everyone designs their menu by themselves so that we have a variety of cool looking menus, each one with their own little touch ;)
    The menu pls
     
    Back
    Top