This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Tile Matrix


Tile Matrix

Postby mmtbb » Nov 13, 2004 @ 12:17am

What we need is a tile matrix function where an image can hold the appropriate tile frames and they can be quickly rendered by passing a matrix or array to a TileMap() (or whatever you want to call it) function

Ex:

[0,0,0,0,1,1,1,1,1,0,0,0
0,0,0,0,1,0,0,0,1,0,0,0
0,0,0,0,1,0,0,0,1,0,0,0
0,0,0,0,1,1,1,1,1,0,0,0]

you get the idea.
mmtbb
pm Member
 
Posts: 277
Joined: Mar 18, 2004 @ 6:56am


Postby kornalius » Nov 13, 2004 @ 12:48am

Regards,
Kornalius
President
ArianeSoft Inc.
http://www.arianesoft.ca
User avatar
kornalius
pm Member
 
Posts: 1704
Joined: Dec 9, 2003 @ 6:04pm
Location: Montreal, Québec, Canada


Postby mmtbb » Nov 13, 2004 @ 1:05am

does this take a lot of fps to render constantly with so many sprites? Also with this would you be able to have certain tiles cause collision?
mmtbb
pm Member
 
Posts: 277
Joined: Mar 18, 2004 @ 6:56am


Postby sponge » Nov 13, 2004 @ 1:47am

holy internets batman.
User avatar
sponge
Not sponge
 
Posts: 12779
Joined: Jan 13, 2002 @ 8:04am
Location: New Hampshire


Postby kornalius » Nov 13, 2004 @ 3:45am

Regards,
Kornalius
President
ArianeSoft Inc.
http://www.arianesoft.ca
User avatar
kornalius
pm Member
 
Posts: 1704
Joined: Dec 9, 2003 @ 6:04pm
Location: Montreal, Québec, Canada


Postby mmtbb » Nov 13, 2004 @ 4:09am

mmtbb
pm Member
 
Posts: 277
Joined: Mar 18, 2004 @ 6:56am


Postby kornalius » Nov 13, 2004 @ 4:32am

The @ converts an address into actual data in a variable.

Dim(d$, 10);
d$[0] = "THIS IS A STRING";

In PPL a lot of the string data is stored as an address value.

ShowMessage(d$[0]);

Will not print "THIS IS A STRING" but it's address value.

ShowMessage(@d$[0]);

Will convert the address value into it's actual content and print "THIS IS A STRING".

In the case of a matrix:

a$ = [10, 10];

a$ points to a memory location that holds the matrix elements 10, 10.

ShowMessage(a$);

Will print the address.

a$ = [[10,10]];

a$ still points to a memory location. But the first element of the matrix also point to another matrix (called a sub-matrix) that holds elements 10,10.

ShowMessage(a$[0]);

Will print the address pointed by element 0 of the matrix a$.

In order to get the actual data and process it, you need to transfer from an address to data.

ShowMessage(@a$[0][1]);

Converts a$[0] to data and then print matrix element of sub-matrix, which is 10.

The matrix is stored like this:

a$ = [10, 20, [30, 40]];

a$ : 10, 20, [address-1]
address-1 : 30, 40

-----------------------------------------------------

A sprite is just a set of values (including a surface pointer) for the engine to use. A sprite is not a surface in itself.
Regards,
Kornalius
President
ArianeSoft Inc.
http://www.arianesoft.ca
User avatar
kornalius
pm Member
 
Posts: 1704
Joined: Dec 9, 2003 @ 6:04pm
Location: Montreal, Québec, Canada


Postby mmtbb » Nov 13, 2004 @ 6:16am

tune in next week when we discuss chapter 14 of the latest release from Microsoft Press, "PPL, the early years" :wink:

Thanks for the explaination. I understood everything up to the part where a$=[[10,10]]. here is where you lost me. Is a matrix like an array? I don't understand the double brackets

So does a$[0][1,1]="wew" work?
mmtbb
pm Member
 
Posts: 277
Joined: Mar 18, 2004 @ 6:56am


Postby kornalius » Nov 13, 2004 @ 2:59pm

Regards,
Kornalius
President
ArianeSoft Inc.
http://www.arianesoft.ca
User avatar
kornalius
pm Member
 
Posts: 1704
Joined: Dec 9, 2003 @ 6:04pm
Location: Montreal, Québec, Canada


Postby mmtbb » Nov 13, 2004 @ 3:31pm

Ok, this whole time I have been confusing arrays with matrices.
Let's see if I understand right.

I create the following matrix:

a$ = [0,1,2,"You ",4,"Rock! ",["Big ","Time"]];

Now, if I would access these these are the values I would get:

a$[1] equals the number 1,
@a$[3] equals the string "You ",
a$[4] equals the number 4,
@a$[7][1] equals the string "Time ".

Is this correct?
mmtbb
pm Member
 
Posts: 277
Joined: Mar 18, 2004 @ 6:56am


Postby kornalius » Nov 13, 2004 @ 7:04pm

Correct, except:

@a$[7][1] equals the string "Time ".

should be:

@a$[6][1] equals the string "Time ".
Regards,
Kornalius
President
ArianeSoft Inc.
http://www.arianesoft.ca
User avatar
kornalius
pm Member
 
Posts: 1704
Joined: Dec 9, 2003 @ 6:04pm
Location: Montreal, Québec, Canada


Postby sponge » Nov 13, 2004 @ 7:15pm

holy internets batman.
User avatar
sponge
Not sponge
 
Posts: 12779
Joined: Jan 13, 2002 @ 8:04am
Location: New Hampshire


Postby mmtbb » Nov 13, 2004 @ 7:49pm

sponge, I would like that. you can PM me. Thanks

kornalius, if this is the case, it seems that an array would serve better for a map because it can have, but more importantly be called be dimension

ex:
Sprite located at a$[1,1] = 3

Is there an advantage for making map grids that a matrix would have over this?
mmtbb
pm Member
 
Posts: 277
Joined: Mar 18, 2004 @ 6:56am


Postby kornalius » Nov 14, 2004 @ 5:49am

Regards,
Kornalius
President
ArianeSoft Inc.
http://www.arianesoft.ca
User avatar
kornalius
pm Member
 
Posts: 1704
Joined: Dec 9, 2003 @ 6:04pm
Location: Montreal, Québec, Canada


Postby mmtbb » Nov 14, 2004 @ 7:32am

how I have done maps in the past is:

dim(fakemap$,6);
dim(map$,6,6);

fakemap$[0] = "0,0,0,1,1,1";
fakemap$[1] = "0,0,0,1,0,1";
fakemap$[2] = "0,0,0,1,0,1";
fakemap$[3] = "0,0,0,1,0,1";
fakemap$[4] = "0,0,0,1,1,1";
fakemap$[5] = "0,0,0,0,0,0";

Then I use a split function to seperate the strings delimited by a comma and fill up the real map$ elements by processing with 2 FOR loops. This has worked fantastic for me in the past.
mmtbb
pm Member
 
Posts: 277
Joined: Mar 18, 2004 @ 6:56am


Next

Return to Pocket Programming Language (PPL)


Sort


Forum Description

Discuss this new development tool.

Moderator:

kornalius

Forum permissions

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
You cannot post attachments in this forum

cron