Page 1 of 2 12 LastLast
Results 1 to 40 of 62

Thread: RPGs - Map file?

  1. #1

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    I'm in the process pf making an RPG. I need to know:
    -How to stop the character from wondering off the screen
    -How to make the screen change when a character touches a certain spot (like a door)
    -How to deal with money...

    I may be asking for a lot, but... hey every VB prrogramer was new at one time!

    Thanks,
    -Spie

  2. #2
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Clip the characters to the screen... Implement a script system so the tiles where the player walks on perform an action as changing the map...
    Money maybe a property of the player, if you have vendor characters you should make a little talk-system so the player can buy things and then just add/subtract money from the chars..

  3. #3
    Guest
    To make the screen change when you hit a door, simply check the spot before you move, for example:
    Code:
    Const DOOR = 4
    
    If UpArrowIsPress Then
        If NextSpot = DOOR Then
            'ChangeScreen
        End If
    End If

  4. #4

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    how do I tell it where the door is?

  5. #5
    Addicted Member drewski's Avatar
    Join Date
    Feb 2000
    Location
    WA
    Posts
    242
    When you do something like this you need to keep track of where things are. In doing this you need to keep track of the following:

    1. When you make the map you need to find the X & Y coordinates of where the door is.

    2. You need to keep track of the X & Y coordinates of where the character is as he moves around.

    3. When the X & Y coordinates of the characters position equal that of the doors you need to change the picture.

    When making a game Spie you always need to keep track of everything. You sound as if you are pretty new to this type of thing
    I see said the blind man as he spat into the wind.

    It all comes back to me now!

    A.D.T.'s VB

  6. #6

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    Uh. Yeah, I am rather new. I am trying to learn C++, but I can't get a strait answer from anyone. I came back to VB because everyone seems nicer... Heh, maybie I am just wierd!

    I may be doing this wrong... I made the background of the form the picture of the screen. I do not think this is right is it? If not... If it is not too much trouble, please tell me how. If you want to, you can e-mail me so you don't flood this form. My e-mail adress is [email protected] .

    Thanks, and sorry for all the trouble,
    Spie

  7. #7

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    Btw. I like your signature

  8. #8
    Guest
    I see said the blind man to his deaf wife...

    Try storing your Map in a Byte Array. That way you have your whole map in "1 variable". Then when you are about to move the character, do the following:
    • Check which direction (and get the X and Y positon)
      Get the type of tile in that current position
      Check if it's a door (or whatever)
      If so, then do a special action


  9. #9
    Addicted Member drewski's Avatar
    Join Date
    Feb 2000
    Location
    WA
    Posts
    242
    Well I could give you a little help on problems here and there but I'm not the best programmer out there. VB is just a hobby of mine and I'm not one of those people who program 24 hours a day If I were you I would go and find some tutorails online somewhere.

    I learned all of my basic stuff from gollum's site : http://www.oneringsoftware.com

    I started a game once but I didnt finish it all the way. It just got to be too much work. The grafix arent that good, the code was a nightmare, and it is only half way commented. If you want to take a look at it is at my new website here: http://www.geocities.com/adt_vb/index.html

    I would also asking someone else with more experience than me such as Fox. He'll probably be able to answer most of you questons. But hey I'll give them a try

    drewski
    I see said the blind man as he spat into the wind.

    It all comes back to me now!

    A.D.T.'s VB

  10. #10

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    I noticed you had a .map file... what is this for?

  11. #11

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    Ok, I'm chanign the topic again! lol I am using GetAsyncKeyState... How to I make it return to what it was before the button was pressed?
    For example, Label1 was set to say "Hi". When you pressed the up key it was set to say "Hello". How do I make is go back to "hi" when you release the key?

  12. #12

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    How do I make a Byte Array?
    (sorry for all the questions )

  13. #13
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Dim A(200) as Byte

    or


    Dim A() as Byte


    Redim A(200)

  14. #14

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    How do I make the map, though?

  15. #15
    Guest
    That is the Map.



    Regarding your problem with GetAsyncKeyState:
    Code:
    Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    
    Private Sub Timer1_Timer()
        If GetAsyncKeyState(vbKeyUp) Then
            Label1 = "Hello"
        Else
            Label1 = "hi"
        End If
    End Sub

  16. #16

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    Thanks, That helped.. but how do I stop the character from leaving the screen. Do I change the number in:
    Dim A(500) As Byte
    ?

  17. #17
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    The number in A(23) is for example 4. Then you have a tile array where such things are stored: Tile(4).Collides = True

    know what I mean?

  18. #18

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    lol...no (i hate being new )

  19. #19
    Guest
    If the end of the map is 0,0 then use
    Code:
    If You.X < 0 Then You.X = 0
    If You.Y < 0 Then You.Y = 0

  20. #20

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    I'm using a picture box with the picture loaded as my map... am I doing this wrong?

  21. #21
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Yeah, you need to start over, to have a map based rpg you need to draw tiles, set up a game structure by using UDT's and some basic graphical methods for drawing a scrollable tiled map with sprites. I think you'll find a lot of that at Fox programming site
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  22. #22

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    Ok, im gonna go alittle off topic again... how do I animate a four frame picture? I only have the code for a two frame animation.

  23. #23
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    This shows how yo use UDT's for for instance animated frames, you make a counter that goes from 0 to the amount of frames-1 and then store the frames in a dynamic stdpicture array.
    Code:
    Type animation
       counter as byte
       frames as byte
       pic() as stdpicture
    end type
    
    Dim spie as animation
    
    Sub Animate(Ani as animation)
        Ani.counter=(Ani.counter+1) mod ani.frames
    end sub
    Sub showAnimation(Ani as animation, target as stdpicture)
        Set Target.picture=ani.pic(ani.counter)
    end sub
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  24. #24
    Guest
    A good idea to keep organized is to make a class for a player. In there, you can create properties for Frames, X and Y positions, hitpoints, strength etc.

  25. #25

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    Another question (sorry)
    How do I return the character to the normal standing position? I can make him look like he is running, but when he stops he is still on one leg.
    code:
    Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer



    If GetAsyncKeyState(vbKeyDown) Then
    char1.Picture = chardown.Picture
    char1.Top = char1.Top + 70
    End If



    I tried using the else thing, like I did on the labels, but it didnt help.

  26. #26

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    Is there an easier way to stop the character from running off the screen? Or is there a website that explains it?

  27. #27
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    1. YOu can implement scrolling in your game, and make it scroll automatically when you get to one edge of the screen
    2. You can check if the character position is at any edge of the screen and disable him from moving
    3. You can make him teleport to the other side of the screen, well this depends how you want your game to react when he comes to an edge.

    To make him stop running, just blit the not-running image over him when you haven't pressed any key to move him.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  28. #28
    Guest
    Spie: Why not use a Map for your character? It'll be much easier.
    Code:
    If GetAsyncKeyState(vbKeyDown) Then Character.Y = Character.Y + 1

  29. #29

    Thread Starter
    Lively Member Spie's Avatar
    Join Date
    Jul 2000
    Location
    On a very small coconut somewhere near Mars
    Posts
    126
    How do I "define" .y and .x? I have tried putting it in the module, but the program seems to want to discard that information...

  30. #30
    New Member
    Join Date
    Sep 2000
    Location
    Sweden
    Posts
    11

    Hi there

    You have a lot of questions, maybe you should get a VB-Book.
    Not for amateurs but for Users so that you can lookup these
    common questions.

    I hope you don't move around imageboxes.
    Collect all the data for the next screen and then use 'drawpicture' to get it on the screen.
    Tip: U should not use any thing but Static pictures, Perhaps the background Image Could be a Image box and the
    Interface.

    This was a thing I used to do wrong.
    Assembler is more then a Language, it's a Religion

  31. #31
    Addicted Member tonyenkiducx's Avatar
    Join Date
    Oct 2000
    Location
    London England
    Posts
    147

    Cool

    Heres what I found to be the easiest way to program a movement system.

    Create 2 arrays, one is your map, the other is your Character.

    Dim CharacterArray(5)
    Dim MapArray(10,10,1) ' this will allow for a set of squares, 10 by 10.


    Then you need to setup the map array, you need to draw the 10 by 10 grid on paper, and draw your map on it using 1 square as a location. Then make a note on each square what exits are available, using N for north, S for south and so on. Then match up the grid locations, (i.e. 2(across),5(down)) and do...

    MapArray(2,5,0) = "NS" ' this tells the program that the user can move North, and South
    MapArray(2,5,1) = "An empty Street" ' This is the description of the location.


    Then the character array contains this data.

    CharacterArray(0) = "Allanon" ' There name
    CharacterArray(1) = 0 ' There Across position in relation to the maparray
    CharacterArray(2) = 0 ' There Down position in relation to the maparray


    Then When a character requests to move, all you need do is this code...

    If moverequest = "N" and instr(maparray(characterarray(1),characterarray(2),0),"N") Then
    CharacterArray(2) = CharacterArray(2) + 1
    End If

    TO move south, just subtract 1 from that, and user characterarray(1) for moving east and west.

    Then all you need to do it print out the description..

    User.Screen.Caption = maparray(characterarray(1),characterarray(2),1)

    You can expand on this lots, adding up and down, is very easy, and both the character array, and the map array can have any amount of extra data added to them.

    Tony@Work.

  32. #32
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Either make a character class or UDT, to make a UDT, in declarations type:
    Code:
    Type Character
       X as integer
       Y as integer
       'more here later when you need more characteristics..
    end type
    Or for a classmodule, add a new classmodule to your project and declare X and Y as public variables in it, or as two private variables with property get and let statements to access them
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  33. #33
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    Do you think it might be better to stick to procedural programming for a while until he properly understands it? It's perfectly possible to do it procedurally, without object orientation, and it might make things simpler.
    Harry.

    "From one thing, know ten thousand things."

  34. #34
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Well UDT's aren't OO, but they are useful anyway so i think we could keep them, since it gives your game a nice structure without getting Object oriented.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  35. #35
    Frenzied Member HarryW's Avatar
    Join Date
    Jan 2000
    Location
    Heiho no michi
    Posts
    1,827
    That's what I mean, use UDTs but not class modules.
    Harry.

    "From one thing, know ten thousand things."

  36. #36
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    UDTs are classes without Subs and Functions... in C Structs are the UDTs and structs are the same as classes (internal).

  37. #37
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    UDTs are classes without Subs and Functions... in C Structs are the UDTs and structs are the same as classes (internal).

    Both, classes and structs/UDTs are only to make code easier and probably faster...

  38. #38
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Yeah Fox that's generally what differs UDT's and classes.
    But there are some other differences:
    Objects have an address and has to be instanced with NEw keyword. Types are always types, not any references. YOu can't pass a type byval and types must be passed to methods with the correct argument, with object you can use As object and pass anything.
    Objects also takes up more space and are slower to use
    well hope i didn't sound like objects are bad, they rock if you use them in the correct situation
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  39. #39
    PowerPoster Fox's Avatar
    Join Date
    Jan 2000
    Location
    *afk*
    Posts
    2,088
    Of course, I just wanted to say that in C both are the same. They're both the same speed, take the same memory... managed exactly the same

  40. #40
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Ah, that sounds easy
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

Page 1 of 2 12 LastLast

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