|
-
Mar 16th, 2013, 11:13 AM
#1
Thread Starter
PowerPoster
[General] - i need some advices\Sugestions
what a Sprite struture have besides Position and Size?
i have 2 strutures(Sprite and Images(mask image inclued). and more 3 functions: LoadImage(), DrawImage() and DestroyObjects(). i wanted some sugestions for connet these all and be more easy to use.
-
Mar 16th, 2013, 11:31 AM
#2
Re: [General] - i need some advices\Sugestions
A sprite structure can have whatever you desire. Its not limited to just whats proper. Its anything you want! Thats the beauty of programming. If its an RPG it can have Strength, Agility, Intellect, Dexterity, Spirit, Health, Mana, etc etc. If its a platformer, fighting game, or even an rpg (which ever genre has animation), it can have animation states such as standing, walking, running, shooting, falling, dieing, etc. The only limit is your imagination.
-
Mar 16th, 2013, 01:50 PM
#3
Thread Starter
PowerPoster
Re: [General] - i need some advices\Sugestions
 Originally Posted by Jacob Roman
A sprite structure can have whatever you desire. Its not limited to just whats proper. Its anything you want! Thats the beauty of programming. If its an RPG it can have Strength, Agility, Intellect, Dexterity, Spirit, Health, Mana, etc etc. If its a platformer, fighting game, or even an rpg (which ever genre has animation), it can have animation states such as standing, walking, running, shooting, falling, dieing, etc. The only limit is your imagination.
but honestly i need more than that info, but that's.
i think that for LoadImage(), DrawImage(), DeleteObjects() i can do a class
thanks
-
Mar 20th, 2013, 04:25 PM
#4
Re: [General] - i need some advices\Sugestions
When it comes to Game Programming in vb6, you should never ever use a class where subs/functions get called over and over in the main loop and I'll explain why. I have done a number of tests in the past for how long it takes to execute 10,000,000 cycles using a very simple test. Here is the source code to that test:
vb Code:
Option Explicit Private Declare Function GetTickCount Lib "kernel32" () As Long Dim Start As Long Dim Finish As Long Dim I As Long Dim A As Long Dim B As Long Dim C As Long Private Sub Command1_Click() Start = GetTickCount For I = 1 To 10000000 'Your Test Here Next I Finish = GetTickCount Debug.Print (Finish - Start) End Sub
Now were going to use a test subroutine:
I did this test 10 times to receive 10 different values knowing that sometimes its fast and sometimes its not (although the values will be around that range), then divided by 10 to obtain an average. And these are the results I received:
Empty Subroutine with Public, no Call statement and no arguements called in same Form: 887.5 ms
Empty Subroutine with Public, with Call statement and no arguements called in same form: 889.5 ms (hardly a difference using a Call statement)
Empty Subroutine with Public, no Call statement, and no arguements in a Module called in a Form: 755 ms (faster to do subs in a regular module)
Empty Subroutine with Public, with Call statement, and no arguements in a Module called in a Form: 744.4 ms (hardly a difference using a Call statement)
Empty Subroutine with Public, no Call statement, and no arguements in a Class Module called in a Form: 1246.7 ms (*** too slow to use a class module)
I also found If statements being false are much much slower than If statements being true (you'd think it would be the opposite), and you should never use IIF() functions:
If Statements
----------------------------
False If Statement Block checking if Long variable has value: 246.6
If A Then
End If
True If Statement Block checking if Long variable has value: 230.8
If A Then
End If
False If Statement Block checking if Long variable > 0: 290
If A > 0 Then
End If
True If Statement Block checking if Long variable > 0: 245.2
If A > 0 Then
End If
False If Statement Block checking if Long variable > Long variable: 290.1
If A > B Then
End If
False If Statement in no block checking if Long variable has value then A = B: 243.6
If A Then A = B
If Then Else Block with no conditions checking if Long variable has value: 259.1
If A Then
Else
End If
If Then Else Block with conditions checking if Long variable has value then change its value: 424.5
If A Then
A = 0
Else
A = 1
End If
If Then Else Block with conditions checking if Long variable has value then change another Long variables values: 358.7
If A Then
B = 1
Else
B = 0
End If
----------------------------
Select Case Statements
----------------------------
False Select Case Long variable with one arguement checking if 0: 324.5
Select Case A
Case 1
End Select
True Select Case Long variable with one arguement checking if 0: 312.1
Select Case A
Case 0
End Select
----------------------------
IIf Statements
----------------------------
IIf Statement to see if Long variable has value: 1865.6
A = IIf(A, 1, 0)
Theres a bunch more tests I need to do but it gives you an idea.
-
Mar 28th, 2013, 02:45 PM
#5
Thread Starter
PowerPoster
Re: [General] - i need some advices\Sugestions
i understand that... but in my case it's more diferent and i don't need code... just advices
- my class Image do: Load(), Draw() and Destroy().
- the Sprite structure have the position and size and Visible;
- the Images structure have the HBitmap, Bitmap, HDC, and for the mask: HBitmap, Bitmap, HDC.
i wanted combine these in Sprite(for be more easy to use). anyone can give more advices?
thanks for all
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
|