Results 1 to 5 of 5

Thread: Help me with Rpg!!!!!

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Posts
    20

    Angry

    im making a rpg or trying to make but i don't know
    how to stop the character to stop moving when hes walking on a tree.

    the background is image1 jpg and the character is image2 and the tree is image3.

    the code is:

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyUp Then Image2.Top = Image2.Top - 200
    If KeyCode = vbKeyDown Then Image2.Top = Image2.Top + 200
    If KeyCode = vbKeyLeft Then Image2.Move Image2.Left - 200
    If KeyCode = vbKeyRight Then Image2.Move Image2.Left + 200


    End Sub

  2. #2
    Guest
    First, you should have a numeric version of your Map stored in a 2-D Array. Then, before you move your character, check what is above him. If it's a Tree then don't move him.

  3. #3
    Frenzied Member
    Join Date
    Jul 1999
    Posts
    1,800
    But how would you know what side he is being hit by? You have to be able to make one of the directions not work. How do we know which one?

  4. #4
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Just check all directions.. you can make something like this to define collidable sides:

    Code:
    tTile
       CollideLeft as Boolean
       CollideTop as Boolean
       ...
    End Type
    
    Map(W,H) as tTile
    
    MoveChar()
       If Map(Player.x / TileWidth, Player.y / TileHeight).CollideLeft = True Then
          'Collide left
       EndIf
    
       If Map(Player.x / TileWidth, Player.y / TileHeight).CollideTop = True Then
          'Collide top
       EndIf
    
       ...
    End Sub
    See the idea?

  5. #5
    New Member
    Join Date
    Jul 2000
    Location
    Watertown,CT
    Posts
    8

    Lightbulb Ok.......

    This post is for Fox
    Im usin 1 of you characters that i got from your project on animation and im wonder the same question but how do i put that into the code i got already.....you should kno the code it came from your web page.
    I NEED HELP!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width