Hi guys, I wonder if someone can help me here?
I am trying to create a sprite structure like so
Stucture Car
X.w
Y.w
Id.l
EndStructure
Dim Sprite.Car(9)
Global CurrentSprite = 5
This is the problem:
If Xpos < Sprite(CurrentSprite)\Id <--- I need the ID as well as the X, how is this done?
Thanks for your help in advance.
Sprite Structure
-
Pot Noodle
- Enthusiast

- Posts: 202
- Joined: Sat Feb 18, 2012 10:21 pm
- Location: Leicestershire
Sprite Structure
P.N.
Re: Sprite Structure
Code: Select all
Structure Car
X.w
Y.w
Id.l
EndStructure
Dim Cars.Car(0)
For i=1 To 10
ReDim Cars(i)
Cars(i)\Id=i
Cars(i)\X=i*10
Next
CurrentSprite = 5
Debug Cars(CurrentSprite)\Id
Debug Cars(CurrentSprite)\X
➽ Windows 11 64-bit - PB 6.21 x64 - AMD Ryzen 7 - NVIDIA GeForce GTX 1650 Ti
Sorry for my bad english and the Dunning–Kruger effect
-
Pot Noodle
- Enthusiast

- Posts: 202
- Joined: Sat Feb 18, 2012 10:21 pm
- Location: Leicestershire
Re: Sprite Structure
I think you misunderstood me, what i want to do isStructure Car
X.w
Y.w
Id.l
EndStructure
Dim Cars.Car(0)
For i=1 To 10
ReDim Cars(i)
Cars(i)\Id=i
Cars(i)\X=i*10
Next
CurrentSprite = 5
Debug Cars(CurrentSprite)\Id
Debug Cars(CurrentSprite)\X
Retreve the X cord from a sprite so it should look something like this:
If Xpos < Sprite(Index)\ID\X
But I have 1 to 9 sprites so i use CurrentSprite to identify the sprite in the Array then I need the ID of the Sprite then I need the X Cord of the sprite and thats the problem!
P.N.
Re: Sprite Structure
a Sprite have not X-coordinate.
You must have your own structure like:
then you save in Car and read it:
You must have your own structure like:
Code: Select all
Structure Sprite
ID.i
X.i
Y.i
EndStructure
Structure Car
*Sprite.Sprite
EndStructure
Code: Select all
Sprite1.Sprite
Sprite1\ID = LoadSprite(...)
Sprite1\X = ...
MyCar.Car
MyCar\Sprite = @Sprite1
;....
If X < MyCar\Sprite\X
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Lizard - Script language for symbolic calculations and more ― Typeface - Sprite-based font include/module
Re: Sprite Structure
My AnimateSprite() procedure returns the frame number for sprite sheet.
http://www.purebasic.fr/english/viewtop ... 16#p284416
You might also look at this post for Data sprites...
http://www.purebasic.fr/english/viewtop ... 16&t=49979
http://www.purebasic.fr/english/viewtop ... 16#p284416
You might also look at this post for Data sprites...
http://www.purebasic.fr/english/viewtop ... 16&t=49979
www.posemotion.com
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef
Even the vine knows it surroundings but the man with eyes does not.
