none
Title Screen Animation Not Smooth RRS feed

  • Question

  • I'm trying to create a game however the animation for the Title Screen isn't very smooth. Can someone please help me fix this problem? Thanks

     

    'Initialize GraphicsWindow.
    
    GraphicsWindow.Title = "CHANCE CHASER"
    GraphicsWindow.Width = 1024
    GraphicsWindow.Height = 768
    GraphicsWindow.BackgroundColor = "White"
    'GraphicsWindow.CanResize = "False"
    GraphicsWindow.Left = (Desktop.Width - GraphicsWindow.Width) / 2
    GraphicsWindow.Top = (Desktop.Height - GraphicsWindow.Height) / 2
    
    LogoCenterX = (GraphicsWindow.Width - 452) / 2
    LogoCenterY = (GraphicsWindow.Height - 129) / 2
    
    TitleX = (GraphicsWindow.Width - 784) / 2
    TitleYStart = -650
    TitleYEnd = -50
    'Initialize logo.
    
    GraphicsWindow.BrushColor = "White"
    
    LogoCover = Shapes.AddRectangle(GraphicsWindow.Width, GraphicsWindow.Height)
    
    Shapes.Move(LogoCover, 0, 0)
    
    Logo = ImageList.LoadImage("C:\Users\RESISTANCE1982\Desktop\CHANCE CHASER\PRODUCTION\IMAGES\logo.jpg")
    
    GraphicsWindow.DrawImage(Logo, LogoCenterX, LogoCenterY)
    
    'Run subroutine to fade the logo in and out and clear the window
    
    FadeLogoInOut()
    
    GraphicsWindow.Clear()
    
    Program.Delay(3000)
    
    'Title screen begins here
    
    TitleScreen:
    
    Title = ImageList.LoadImage("C:\Users\RESISTANCE1982\Desktop\CHANCE CHASER\PRODUCTION\IMAGES\title.jpg")
    
    MoveTitle()
    
    'Logo subroutine
    
    Sub FadeLogoInOut
     
     For i = 100 To 1 Step -1
      
      Shapes.SetOpacity(LogoCover, i)
      Program.Delay(50)
      
     EndFor
     
     Program.Delay(1000)
     
     For i = 1 To 100
      
      Shapes.SetOpacity(LogoCover, i)
      Program.Delay(50)
      
     EndFor
     
    EndSub
    
    'Title subroutine
    
    Sub MoveTitle
    
     For i = TitleYStart To TitleYEnd
     
      GraphicsWindow.DrawImage(Title, TitleX, i)
      Program.Delay(5)
     
     EndFor
    
    EndSub

    Saturday, November 13, 2010 2:22 PM

Answers

  • With martmen's suggestion, try also using an image for the title graphics:

    Also possibly use a longer dealy (at least 10) on my PC - to speed it up if you want change the step to -2 rather than reduce the delay, since the delay needs to be long enough to ensure the drawing movement is completed before the next move to keep it smooth.

    TitleScreen:
    Title = ImageList.LoadImage("C:\Users\RESISTANCE1982\Desktop\CHANCE CHASER\PRODUCTION\IMAGES\title.jpg")
    TitleImage = Shapes.AddImage(Title)
    MoveTitle()

    Sub MoveTitle
      For i = TitleYStart To TitleYEnd Step -1
        Shapes.Move(TitleImage, TitleX, i)
        Program.Delay(10)
      EndFor
    EndSub

    Tuesday, November 23, 2010 8:15 PM
    Moderator
  • put in:

    TitleYStart = 650

    TitleYEnd = 50

    the loop in Movetitle with step -1

    now it runs

     


    Best Regards Martin
    Sunday, November 14, 2010 9:28 AM

All replies

  • It runs fine on my computer.

    You could try use:

    'Show

    StartTime = Clock.ElapsedMilliseconds

    While (Clock.ElapsedMilliseconds - StartTime) < 1500

      Shapes.SetOpacity(LogoCover, 100-((Clock.ElapsedMilliseconds - StartTime) / 15))

    EndWhile

    Program.Delay(2000)

    'Hide

    StartTime = Clock.ElapsedMilliseconds

    While (Clock.ElapsedMilliseconds - StartTime) < 1500

      Shapes.SetOpacity(LogoCover, ((Clock.ElapsedMilliseconds - StartTime) / 15))

    EndWhile

     

    If you don't understand that code, you can just ask.

    Saturday, November 13, 2010 9:29 PM
  • that part works fine, the problem is when the title is moving down from the top of the window
    Sunday, November 14, 2010 1:12 AM
  • put in:

    TitleYStart = 650

    TitleYEnd = 50

    the loop in Movetitle with step -1

    now it runs

     


    Best Regards Martin
    Sunday, November 14, 2010 9:28 AM
  • it already runs, i'm saying the movement is jerky
    Sunday, November 14, 2010 4:25 PM
  • With martmen's suggestion, try also using an image for the title graphics:

    Also possibly use a longer dealy (at least 10) on my PC - to speed it up if you want change the step to -2 rather than reduce the delay, since the delay needs to be long enough to ensure the drawing movement is completed before the next move to keep it smooth.

    TitleScreen:
    Title = ImageList.LoadImage("C:\Users\RESISTANCE1982\Desktop\CHANCE CHASER\PRODUCTION\IMAGES\title.jpg")
    TitleImage = Shapes.AddImage(Title)
    MoveTitle()

    Sub MoveTitle
      For i = TitleYStart To TitleYEnd Step -1
        Shapes.Move(TitleImage, TitleX, i)
        Program.Delay(10)
      EndFor
    EndSub

    Tuesday, November 23, 2010 8:15 PM
    Moderator