It is currently Sun May 26, 2013 7:08 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Sprite Structure
PostPosted: Sat Jun 02, 2012 10:14 pm 
Offline
User
User

Joined: Sat Feb 18, 2012 10:21 pm
Posts: 80
Location: Leicestershire
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.

_________________
P.N.


Top
 Profile  
 
 Post subject: Re: Sprite Structure
PostPosted: Sat Jun 02, 2012 10:26 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Sep 21, 2011 9:11 am
Posts: 125
Location: France (Paris)
Code:
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

_________________
Noob Inside - (Windows XP, 7 & 8: Full Version PB 4.51 -> 5.00)


Top
 Profile  
 
 Post subject: Re: Sprite Structure
PostPosted: Sat Jun 02, 2012 10:38 pm 
Offline
User
User

Joined: Sat Feb 18, 2012 10:21 pm
Posts: 80
Location: Leicestershire
Quote:
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


I think you misunderstood me, what i want to do is
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.


Top
 Profile  
 
 Post subject: Re: Sprite Structure
PostPosted: Sat Jun 02, 2012 11:03 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Thu Jan 10, 2008 1:30 pm
Posts: 711
Location: Germany, Glienicke
a Sprite have not X-coordinate.

You must have your own structure like:
Code:
Structure Sprite
  ID.i
  X.i
  Y.i
EndStructure

Structure Car
  *Sprite.Sprite
EndStructure


then you save in Car and read it:
Code:
Sprite1.Sprite
Sprite1\ID = LoadSprite(...)
Sprite1\X = ...
MyCar.Car
MyCar\Sprite = @Sprite1
;....
If X < MyCar\Sprite\X

_________________
Image


Top
 Profile  
 
 Post subject: Re: Sprite Structure
PostPosted: Sat Jun 02, 2012 11:15 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1620
Location: USA
My AnimateSprite() procedure returns the frame number for sprite sheet.
viewtopic.php?p=284416#p284416

You might also look at this post for Data sprites...
viewtopic.php?f=16&t=49979

_________________
AMD 64 4000+ / 1GB PC2700 / WIN XP Home SP3 / Nvidia GT220 x16 512MB / M-Audio Revolution 5.1
Macbook Air 11.6" - 2010 / OS X 10.8

http://www.posemotion.com
http://www.flashpulse.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye