Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact
A1VBCode Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      

Home » Classic Visual Basic (VB 6 or earlier) » Game Programming » Coding a Game Character


Coding a Game CharacterExpand / Collapse
Author
Message
Posted 6/19/2006 9:42:16 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/20/2006 8:18:12 PM
Posts: 1, Visits: 4
I know this has been asked before but I didn't get a clear enough answer. How do you code a character to move around a screen? I also want to know some good websites that have code snippets I believe there called, for rpg types of games. I've looked hours on the internet but I can't find websites that tell you these types of things.
Post #19208
Posted 6/29/2006 2:12:21 PM


Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: Forum Members
Last Login: 6/29/2006 2:03:22 PM
Posts: 7, Visits: 9
Here is the simple code to move ur player in four directions ok......

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeyUp Then

 Shape1.Top = Shape1.Top - 250

end if

If KeyCode = vbKeyDown Then

 Shape1.Top = Shape1.Top + 250

end if

If KeyCode = vbKeyRight Then

 Shape1.Left = Shape1.Left + 250

end if

If KeyCode = vbKeyLeft Then

Shape1.Left = Shape1.Left - 250

end if

End Sub

U can also take any thing insted of shape1 like image or label ok hope that it helps and 250 is the speed of ur player ok.....

Bye Bye take care Manku-D

Nothing to Say.

Post #19275
Posted 4/25/2007 9:23:16 AM


Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 1/28/2008 9:56:29 PM
Posts: 39, Visits: 85
I am a complete noob to the programming scene but I know another way of moving a character...

private sub form_keydown(keycode as integer, shift as integer)

select case keycode

Post #21770
Posted 4/25/2007 9:26:38 AM


Forum Member

Forum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum MemberForum Member

Group: Forum Members
Last Login: 1/28/2008 9:56:29 PM
Posts: 39, Visits: 85
I am a complete noob to the programming scene but I know another way of moving a character...

private sub form_keydown(keycode as integer, shift as integer)

select case keycode

         case vbkeyup

                shape.top = shape.top - (desired speed of the character)

         case vbkeyleft

                shape.left = shape.left - (desired speed of the character)

end select

This I find is easier because there is less typing ivolved and therefore less code to serach through for bugs and stuff, hope it helps.

Post #21771
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 1 (1 guest, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Admin, Mod, Mark, Keithuk

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 4:23am