getResourcesByType('battery', array('resourceID' => $_POST['rid'])); if ( count($objs) == 1 ) { $ob = $objs[0]; if (isset($_POST['get_all_data']) && is_numeric($_POST['get_all_data']) ) { $robo_data = array($ob->getMessages(),$ob->getRoboLandscape(),$ob->getRoboBatteries()); print json_encode($robo_data); } else if (isset($_POST['save_data']) && is_numeric($_POST['save_data']) ) { if ( isset($_POST['landscape']) ) { $ob->setRoboLandscape(json_decode($_POST['landscape'])); } if ( isset($_POST['batteries']) ) { $ob->setRoboBatteries(json_decode($_POST['batteries'])); } $save_message = $ob->saveCompiledGame(); print json_encode($save_message); } } } ?>