• 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] Animating a picture

16
Posts
4
Years
    • Seen May 1, 2023
    Hi Guys, i have a little problem with animating a Pokeball for my Starter Selection Screen.
    I am working with a spritesheet with 4 frames and woud like the Pokeball to animate when it is selected. I am working with the Advanced Starter Selection Script by shiney.
    I also looked into the Xtransceiver script by KleinStudios but cant really seem to figure out hov animating the parts work.
    My script looks like this:
    Code:
      @sprites["ball_1"]=IconSprite.new(0,0,@viewport)
      @sprites["ball_1"].setBitmap("Graphics/Pictures/StarterSelection/ball1")
      @sprites["ball_1"].src_rect.width = @sprites["ball_1"].bitmap.width/4
      @sprites["ball_1"].src_rect.height = @sprites["ball_1"].bitmap.height
      @sprites["ball_1"].x=146
      @sprites["ball_1"].y=163
      @sprites["ball_1"].opacity=0
      @ballcount=0
    
     def openscene
       @sprites["bg"].opacity=255
       @sprites["bag"].opacity=255
       @sprites["ball_1"].opacity=255
       @sprites["ball_2"].opacity=255
       @sprites["ball_3"].opacity=255
       @sprites["select"].opacity=255
       pbWait(1)
       self.update
       self.gettinginput
       self.input_action
     end
     def update
       @ballcount+=1
       if select=1
        if @ballcount==8
         @sprites["ball_1"].src_rect.x = @sprites["ball_1"].src_rect.width
        elsif @ballcount==16
         @sprites["ball_1"].src_rect.x = @sprites["ball_1"].src_rect.width*2
        elsif @ballcount==24
         @sprites["ball_1"].src_rect.x = @sprites["ball_1"].src_rect.width*3
        elsif @ballcount==32
         @sprites["ball_1"].src_rect.x = @sprites["ball_1"].src_rect.width*4
        elsif @ballcount==48 
         @sprites["ball_1"].src_rect.width
         @ballcount=0
        end
       end
     end
    I only copied the relevant blocks to make the reading easier. I will also attach an image of the ball sprite sheet.
    Would really appreciate some help even if its just a hint as to which sections i should look into.
     

    Attachments

    • Animating a picture
      ball1.png
      2.5 KB · Views: 9
    Back
    Top