Visual Basic 2008- Moving Animation with keypads

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
13,975
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Dec 17, 2009

***IMPORTANT READ***
This is a vid about animation using the keypads on visual basic 2008. To use this program u need these two pics which can be copied from http://img121.imageshack.us/i/bat1a.png/ AND http://img5.imageshack.us/i/bat1b.png/ . Just copy the two pics and paste into a place where u know where it is.

***CODE***
Public Class Form1
Dim x As Integer = 0
Dim y As Integer = 0
Dim cycle As Integer = 0
Dim flip As Boolean = False
______________________________________________
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Right Then
x = 5
flip = False
ElseIf e.KeyCode = Keys.Left Then
x = -5
flip = True
ElseIf e.KeyCode = Keys.Up Then
y = -5
ElseIf e.KeyCode = Keys.Down Then
y = 5

End If
End Sub
______________________________________________
Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp




If e.KeyCode = Keys.Right Or e.KeyCode = Keys.Left Or e.KeyCode = Keys.Up Or e.KeyCode = Keys.Down Then
x = 0
y = 0
End If
End Sub
______________________________________________
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If cycle Mod 2 = 0 Then
Me.PictureBox1.Image = My.Resources.bat1_a
Else
Me.PictureBox1.Image = My.Resources.bat1_b
End If
If flip = True Then
Me.PictureBox1.Image.RotateFlip(RotateFlipType.RotateNoneFlipX)


End If
Me.PictureBox1.Left = Me.PictureBox1.Left + x
Me.PictureBox1.Top = Me.PictureBox1.Top + y
cycle += 1
End Sub
End Class
______________________________________________
DONT FORGET TO SUB AND COMMENT!!!!!

Category:

Education

Tags:

License:

Standard YouTube License

  • likes, 1 dislikes

Link to this comment:

Share to:

Uploader Comments (MrShadeslayer)

  • No forum --> form :D

  • @themasterphp lol yes I know sorry. I guess I was rushing and didnt see that :P

  • where did you find the cursor

    Ascolta

  • @BlAdEInAzUmAFiRe00

    The program that I used to record with, Camtasia, has that cursor.

  • nice work

  • @MrHelsinko thanks man

see all

All Comments (71)

Sign In or Sign Up now to post a comment!
  • can someone upload the bat1b on other site?cannt download the bat1b.png

  • Hi! Could you guys please check out my channel? I will do a giveaway when I reach 100 subscribers! Thanks!

  • pliz help :S i get an error in timer 1 i rote the code

    and got an error in

    bat_a and bat_b are tiped in "resources" and conat be used in an expresion

  • nice bro your talented.

    

  • Great, but one what is bad is, that i can leave the Form1 with Picture. But great job. :-)

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more