-
How can i make a field like they use in warcraft, where only you see a certain portion but u can move it around with your mouse and see others.
?
How would the units and all move. Im very curious, please help me out! :D
I was thinking of making a big pic and moving it, but that idea is NO good.
And also, when u guys download sprites... and their in one picture, one after another, do u keep em like that or do u cut them out and open them 1 by 1 alter.
-
I suppose you want to make a tiled map, with terrain tiles. Generally what you do is keep an offset for the x,y in the topleft corner, which you change to have the screen moving. Your blitting procedure will then start at this coordinate in nested loops to run to the side and down like a typewriter, but with set tiles as types instead. Keep a pixel and tile variables separate and increment both.
The units will move if you change their position and have a process for blitting them according to the screen offset. I'm not sure what you mean with the last qwestion
-
What i mean is, when u download sprites they come in one picture, right? like... frame one he will move his leg and in frame two he is shooting a gun.
I have seen some people use that one picture, without cuting out the inside and bitbliting them according to their coordinates on the picture.
What i think is alot easier, is just cuting them out a and bilbliting the entire picture frame by frame, which way do u guys do it or do u still not know what im talking about? :)
Thanks!
-
Well, if i'm correct about what you said, you have a bitmap with all sprites on it, then you want to blit each of them off their positions. I think it's best you load each "frame" into an array of bitmaps, surfaces or whatever instead of getting them by coordinates under the ingame blitting process
-
Yeah your right, but the thing is its got like 50 different positions on them, im gonna have to open the bitmap, and cut out each position and save it as another picture. I guess that would work better but it takes alot more time!
Thanks
-
Ok, i cut out like 62 frames, and put em into an image list array. Now
1. How do i get rid of the flickering
2. How can i slow down the animation proccess
3. How can i erase the old image without actually refreshing the form, because that causes flickering.
I tried using BitBlt vbSrcErase but that causes wierd effects with this TransparentBlt API.
I used a for i loop hehe but that dosent work very well, ... theres no way it can be used in a game. And second of all im thinking of making a timed loop.
Code:
Sample:
dim intWalk as integer
intwalk = 0
do
doevents
intwalk = intwalk + 1
if intwalk = 50 then CallWalk
loop
Any better ideas?
(I hate timers)
-
1&3, set autoredraw to true
2 have a loop doing nothing waiting for gettickcount release it, or use sleep api.
I think you should have a look at Fox famous programming site, there's a link on his signature
-
Dumb question?
The only dumb question is the question never asked, Invitro. ;)
I'm a bit interested in this, as well, and also antialiasing. I don't totally understand how I would do something along the lines of making a point on a VB form, and antialiasing it, and perhapse animating it. I would really like to make some of those DLLs they use in the Windows Media Player that interact with music. :)
-
Antialias - This concept might be a bit diffuse, i'm not sure if i'm right myself, i once tried to make a antialiased circle and it turned out well.
I see it like lines shapes points or whatever, even bitmaps that are floating over the background, i mean that they have a non-integer position so that parts are hovering a set of several pixels in a different degree, and when you draw the shape or whatever on the background each pixel share a degree of the shape hovering it.
A point at 5.23,2.14 would affect pixel 5,2 most and 6,3 least, i thought calculating the distance to it would be the right thing to do and then divide by the cumulative distances to share the right percentage of color affecting each pixel. The restering percentage for each pixel would mix with their own color having each color component multiplied with the percentage and added to shared components... might sound complicated but that's how i interpreted antialiasing
-
To Jotaf98:
I think it would be better if you use a Byte value for the direction, and then define few constants to indicate movement, instead of a string...
-
Nah, you shouldn't bother with that, a speed vector by it's component is how movement is arranged
-
Jotaf98 you are the man, that is exactly what I was looking for, thanks!!!!!
Damn i love this forum
lol
-
If anyone has some simple tutorials on DirectX... and i mean simple, like ways to make a texture, or even draw something on screen, ur more then welcome to E-Mail them or post up a link! ;)
-
Thanks! ;)
I figured out you didn't know much 'bout games, so I kept it as simple as possible. If there aren't that many units in the game, there's no problem in using a bit more memory :)
As to the tutorials, there's lots of them at Unlimited Realities (can't remember the URL) and at Fox's web page ( http://foxmccloud.tsx.org/ ). Have fun!
-
yes jotaf98, that is amazing stuff there.
hey how about using a timer for the walking, use timeapi or i think it was called getTime api... anyways, you need to just use a constant walking rate based on the game settings, and then call walkAction or whatever...
hey dont underestimate for loops, they are more powerful than you think. for the walking, you can say something like:
Code:
for i = 0 to 10000
doEvents
next i
'that should slow down the game
'but i recommend a timer();
ill take that back, for loops are useless in vb... what was i thinking... vb does not give you controll over you for loops.
good luck.
-
In another answer to the flickering question...
AutoRedraw Slows down the application A LOT... so its
horrid for making games. I had the same problem, but
Whn i saw the framerate hit the app took with auto
redraw, i had to search for another alternative. My
answer was the article on vbworld called "Stop That
Flickering!" (handy, no?) when you render your frame,
right before you clear the screen, lock the window (its in
the article on the front page), clear the screen, draw
the frame, unlock the window, then refresh/doevents. I
think thats the order i used (this is off the top of my
head). anyway, hope that helps a bit. =)
-
In my opinion, it's better to use the "GetTickCount" API (like you were trying to suggest).
Code:
'In the declarations:
Private Declare Function GetTickCount Lib "kernel32" Alias "GetTickCount" () As Long
'In your main loop:
Const MilisecondsPerFrame as Long = 100 'Set it to how long you want each frame to take
Do While Running = True
Static LastTick as Long
If LastTick + MilisecondsPerFrame < GetTickCount Then
LastTick = GetTickCount
'Here you should put your game's code
End If
Loop
That should do it ;)
Modify the speed to what you think is better.
Usually 100 or 50 is good enough, but if a frame takes about 300 miliseconds instead of 100, you'll still get 300 miliseconds per frame!
If you include special effects, give the user the option to disable them, because the make the game a bit slower (go to http://www.planet-source-code.com and search for a VB code sample called "Special Effects for BitBlt Games" - by me :) ).