Re: So i'm learning B3D

#11
Sorry if I don't make any sense here, I'm not the best at explaining things but I'll try to keep the jargon as low as possible.
Combine wrote: Alot of things about the TYPEs tutorial confuses me.
For example, it never explains how exactly types are named. In the tutorial, it says

Code: Select all

Type Sprite	
    Field ID, char_tex
End Type
Then it stops referring to that type and just starts using a type that seems to be called "Character" from then on, Which I presume is seperate from "Sprite"
In this case 'Sprite' is the name of the type and 'Character' is the temporary variable name. For example, the line

Code: Select all

Character.Sprite = New Sprite
creates a new Sprite variable called 'Character', and while doing so, also creates the integers 'ID' and 'char_tex' for 'Character' in particular.
Additionally, the tutorial presents this code:

Code: Select all

For C = 1 To 3         ; 3 Characters 
    Character.Sprite = New Sprite
    Character\ID = CreateSprite()
    Read img$, X, Y, Z
    Character\char_tex = LoadAnimTexture( img$, 7, 32, 48, 0, 4 )
    EntityTexture Character\ID, Character\char_tex, 1
    HandleSprite Character\ID, 0, -1
    ScaleSprite Character\ID, 2, 2
    EntityAutoFade Character\ID, 100, 120
    PositionEntity Character\ID, X, Y, Z
Next

Code: Select all

Read img$, X, Y, Z
First off, How does this know which data to look at?
Since there aren't any other Data segments, the Read function defaults to starting at the first entry in 'Characters'. If you have other sets, the Restore function can be used to specify another block.
Secondly, img$ doesn't pop up anywhere else except here:
"Character\char_tex = LoadAnimTexture( img$, 7, 32, 48, 0, 4 )"
Which sets the image to the sprite defined (see below for the data)

The data used by the read command is this:

Code: Select all

.Characters 
Data "char2.bmp", 10, 0, 10
Data "char3.bmp", -10, 0, 10
Data "char4.bmp", 0, 0, 10

But I don't know how the read command knows to look at this data.
img is a temporary string assigned by the Read function in the previous line (that the author probably should've explicitly instantiated in a tutorial for readability, but whatever)

Code: Select all

Read img$, X, Y, Z
What Read does is assigns data found in a 'Data' entry to variables sent as parameters to the function, then assigns an internal pointer to the location after the last data read. For example, the first call of Read is equivalent to

Code: Select all

img = "char2.bmp"
X = 10
Y = 0
Z = 10
The program knows where the last call to Read ended, so when the next call of Read is equivalent to

Code: Select all

img = "char3.bmp"
X = -10
Y = 0
Z = 10
M-x dingus-mode

Re: So i'm learning B3D

#12
Oooh, I get it sort of now!

I got confuseed with the Character.Sprite thing because if it were lua, and you had a table called "Character", and you wrote Character.Sprite = x
it would assign x to "Sprite" in the table "Character" (IIRC)

Thanks for the help!
"now that the victim is in place, the killing bite will be administered in 10 seconds." --Valve.

Beware the man that speaks in hands.

☜☝☞☟ ✌

Re: So i'm learning B3D

#14
samhamnam wrote:Why did you stop using game maker?
Mostly because GM is actually pretty goddamn annoying. I might switch back to it if blitz proves to be too much of a challenge but eh.
"now that the victim is in place, the killing bite will be administered in 10 seconds." --Valve.

Beware the man that speaks in hands.

☜☝☞☟ ✌