Jump to content


BinaryGuardian

Member Since 24 Feb 2010
Offline Last Active Mar 02 2012 06:27 PM

Topics I've Started

Height map for 2D top down platformer

02 March 2012 - 12:49 AM

Okay some i'm working on a top down platform style game and I want to implement a height map system that will alter a z variable. i'm imagining a simple (non visible) gray-scale system below the level that will set the z value allowing me to scale sprites accordingly. Iv'e never really worked seriously on a 3d game but i'm no stranger to programming so rather than reinvent the wheel here I figured id ask for help. There has to be a way right :confused: ?

Cant access variables from a list of objects

04 June 2011 - 11:43 PM

okay so im trying to make an inventory system and below is the code for adding a new item, im to check the inventory list to see if the object with the set "Name" variable exist already, and if it does just increment the value of the object stored there, and if not add a new instance of the object to the list, but when it comes to comparing the variables of the instances stored there, i get an error saying no such variable exist
//arg0 = char item name
//arg1 = value

var ListChk, tempVal, newObj, tempObj;

ListChk=false;


if(ds_list_size(global.Inventory)>0){
for (i=0; i<=ds_list_size(global.Inventory); i+=1){

    tempObj=ds_list_find_value(global.Inventory,i)
       
  if(tempObj.Name==argument0){
     tempObj.Val+=argument1;
     ListChk=true;
     break;
    }
  
}
} 



if(ListChk==false){
newObj=ds_list_add(global.Inventory,obj_Item);
newObj.Name = argument0;
newObj.Val = argument1;

}


the list stores instances of object obj_Item
im so lost and its not letting me access any of the variables that should be stored there, what am i missing