|
-
Sep 29th, 2000, 04:14 PM
#1
Thread Starter
Lively Member
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
-
Sep 30th, 2000, 11:13 AM
#2
PowerPoster
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..
-
Sep 30th, 2000, 12:08 PM
#3
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
-
Sep 30th, 2000, 12:10 PM
#4
Thread Starter
Lively Member
how do I tell it where the door is?
-
Sep 30th, 2000, 06:49 PM
#5
Addicted Member
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
-
Sep 30th, 2000, 07:09 PM
#6
Thread Starter
Lively Member
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
-
Sep 30th, 2000, 07:11 PM
#7
Thread Starter
Lively Member
Btw. I like your signature
-
Sep 30th, 2000, 07:31 PM
#8
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
-
Sep 30th, 2000, 07:33 PM
#9
Addicted Member
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
-
Sep 30th, 2000, 09:23 PM
#10
Thread Starter
Lively Member
I noticed you had a .map file... what is this for?
-
Sep 30th, 2000, 10:17 PM
#11
Thread Starter
Lively Member
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?
-
Oct 1st, 2000, 01:58 PM
#12
Thread Starter
Lively Member
How do I make a Byte Array?
(sorry for all the questions )
-
Oct 1st, 2000, 02:41 PM
#13
PowerPoster
Dim A(200) as Byte
or
Dim A() as Byte
Redim A(200)
-
Oct 1st, 2000, 07:29 PM
#14
Thread Starter
Lively Member
How do I make the map, though?
-
Oct 2nd, 2000, 03:15 PM
#15
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
-
Oct 2nd, 2000, 06:13 PM
#16
Thread Starter
Lively Member
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
?
-
Oct 3rd, 2000, 12:07 AM
#17
PowerPoster
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?
-
Oct 3rd, 2000, 02:17 PM
#18
Thread Starter
Lively Member
lol...no (i hate being new )
-
Oct 3rd, 2000, 02:26 PM
#19
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
-
Oct 3rd, 2000, 05:03 PM
#20
Thread Starter
Lively Member
I'm using a picture box with the picture loaded as my map... am I doing this wrong?
-
Oct 4th, 2000, 02:58 AM
#21
transcendental analytic
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.
-
Oct 4th, 2000, 09:35 PM
#22
Thread Starter
Lively Member
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.
-
Oct 5th, 2000, 05:51 AM
#23
transcendental analytic
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.
-
Oct 5th, 2000, 02:28 PM
#24
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.
-
Oct 6th, 2000, 01:16 PM
#25
Thread Starter
Lively Member
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.
-
Oct 7th, 2000, 02:47 PM
#26
Thread Starter
Lively Member
Is there an easier way to stop the character from running off the screen? Or is there a website that explains it?
-
Oct 9th, 2000, 05:58 AM
#27
transcendental analytic
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.
-
Oct 9th, 2000, 02:20 PM
#28
Spie: Why not use a Map for your character? It'll be much easier.
Code:
If GetAsyncKeyState(vbKeyDown) Then Character.Y = Character.Y + 1
-
Oct 11th, 2000, 06:54 PM
#29
Thread Starter
Lively Member
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...
-
Oct 11th, 2000, 11:10 PM
#30
New Member
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
-
Oct 12th, 2000, 04:47 AM
#31
Addicted Member
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.
-
Oct 12th, 2000, 05:28 AM
#32
transcendental analytic
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.
-
Oct 12th, 2000, 09:53 AM
#33
Frenzied Member
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."
-
Oct 12th, 2000, 10:09 AM
#34
transcendental analytic
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.
-
Oct 12th, 2000, 10:16 AM
#35
Frenzied Member
That's what I mean, use UDTs but not class modules.
Harry.
"From one thing, know ten thousand things."
-
Oct 12th, 2000, 11:12 AM
#36
PowerPoster
UDTs are classes without Subs and Functions... in C Structs are the UDTs and structs are the same as classes (internal).
-
Oct 12th, 2000, 11:12 AM
#37
PowerPoster
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...
-
Oct 12th, 2000, 11:20 AM
#38
transcendental analytic
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.
-
Oct 12th, 2000, 11:35 AM
#39
PowerPoster
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
-
Oct 12th, 2000, 11:50 AM
#40
transcendental analytic
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|