View Single Post
  #7  
Old 08-23-2011, 07:17 AM
0PiX0 0PiX0 is offline
Coder
0PiX0's Avatar
Join Date: Jan 2011
Posts: 130
0PiX0 is a jewel in the rough0PiX0 is a jewel in the rough
Quote:
Originally Posted by cbk1994 View Post
For example, if you wanted to create your own tileset layout without a custom movement system (syntax up for debate):
If the hard-coded movement system were to use a scripted function, it would be the equivalent of using a 0.05s timeout script to check wall collisions. With a more complex custom tileset design, the custom tileType function could be slightly cpu intensive, unless you used some hackish method to streamline the function. This is just something I thought up on the spot, but I guess something like this would remove the need for conditional statements in the tileType function...

PHP Code:
//#CLIENTSIDE
function onCreated() {
  
temp.watertiles    = {1,2,3};
  
temp.blockingtiles = {4,5,6};

  for (
temp.iwatertiles)
    (@
"tiletype_"@i) = 11;

  for (
temp.iblockingtiles)
    (@
"tiletype_"@i) = 22;

  
tileType = function(xy) {
    return (@
"tiletype_"@this.level.tiles[xy]);
  };

  
onWall = function(xy) { 
    return 
tileType(xy) == 22;
  }; 

Function overriding would be useful in some cases I guess.
I would also really like to see the prototype idea implemented.
Reply With Quote