Reply
11 Sep 2012
Member
Playstation Staff

How do I update a RawSpriteTileList so that it scrolls? I have included what I have tried.

3 Replies 134 Views Created 11-09-2012

I accentidently posted this in General but I think it is better suited here. Moderator, if you wish, please delete my post in General.

 

So I am creating a RawSpriteTileList like this:

 

RawSpriteTileList rstl = new RawSpriteTileList(new TextureInfo(new Texture2D("/Application/woodland.png", false), new Vector2i(16, 16)));
			
int tileSize = 32;
			
for( int i=0; i < 30; i++) {
	for( int y = 0; y < 17; y++ ) {
		RawSpriteTile rst = new RawSpriteTile(new TRS(new Bounds2(new Vector2(i * tileSize, y * tileSize), new Vector2((i*tileSize) + 32, (y*tileSize) + 32))), new Vector2i(0, 15), false, false);
		rstl.Sprites.Add(rst);
	}
}

 

How does one go about scrolling this. In my game loop I was attempting to do something like this:

for( int i=0; i < rstl.Sprites.Count; i++) 
{ rstl.Sprites[i].Quad.T.X += 1; }

 But that isn't compiling. This is really basic as I am just trying to figure it out. Any help would be appreciated. 

 

Thanks,

Mike

Please use plain text.
Reply
0 Kudos
Message 1 of 4 (134 Views)
Reply
0 Kudos
Level 7
 
Playstation Staff

Re: How do I update a RawSpriteTileList so that it scrolls? I have included what I have tried.

Hi:

 

Why it's not compiling post the error please =).

 

Cheers,

Please use plain text.
Reply
0 Kudos
Message 2 of 4 (128 Views)
Reply
0 Kudos
Level 1
 
Playstation Staff

Re: How do I update a RawSpriteTileList so that it scrolls? I have included what I have tried.

So the error that I am getting when trying to compile this is: 

 

Error CS1612: Cannot modify the return value of 'System.Collections.Generic.List<Sce.PlayStation.HighLevel.GameEngine2D.RawSpriteTile>.this[int]' because it is not a variable (CS1612) 

 

I have tried it other way to where it would compile however the tiles never moved and the X value didn't appear to change. 

 

If anyone has any suguestions to offer I would appreciate it. 

 

Mike

Please use plain text.
Reply
0 Kudos
Message 3 of 4 (118 Views)
Reply
0 Kudos
Level 3
 
Playstation Staff

Re: How do I update a RawSpriteTileList so that it scrolls? I have included what I have tried.

When you got it to compile, they didn't appear to move because you didn't re-add the tiles afterwards.  You need to clear before you re-add, or else you'll get a smearing effect I believe (and the list will just keep growing).

Grand Sun R.Y.E.Z: Re-spec Your ElduhZ

www.twitter.com/BSNursery
Please use plain text.
Reply
0 Kudos
Message 4 of 4 (114 Views)
Reply
0 Kudos