This page is very difference of my latest engine version ( http://www.isogenicengine.com/documenta ... structure/ )
I try to open and read the example file
but I don't know where should I start point from ???
I need to create new game isometric like HayDay on iOS
where I can find the latest of tutorial for beginner
Re: where I can find the latest of tutorial for beginner
I'am rookie for this
this is my current code
It's simple
I need to integrate my code in to ige engine
this is my current code
It's simple

I need to integrate my code in to ige engine
Code: Select all
(function($){
var farminfo = {};
var levellist = {};
var userproduct = {};
var userproperty = {};
var systemproduct = {};
var systemproperty = {};
var productsource = {};
var productingredient = {};
var userproduct_queue = {};
var userpropertyRecursive = {};
var animalfeeding = {};
var userPropertyByGroup = {};
var roadsideData = {};
var propertyObj = {};
var productObj = {};
var farmObj = {};
var barnObj = {};
var siloObj = {};
var fieldObj = {};
var animalObj = {};
var machineObj = {};
var roadsideObj = {};
var soundObj = {};
var musicObj = {};
var imgsObj = {}
var imageLoadInfo = {'imgs_count': 0, 'num_loaded':0}
var crop_field_empty_count = 0;
var Garden = function(element)
{
var elem = $(element);
var obj = this;
this.initGame = function()
{
$('#loadingscreen').show();
var last_shout_id = $('#last_shout_id').val();
$.ajax(
{
dataType: 'json',
data: 'last_shout_id='+last_shout_id+'&type=init',
timeout: ( ( (default_refresh_time > 0 ? default_refresh_time : 30 ) + 2) * 1000 ),
url: core_url,
success: function(data)
{
//console.log(data);
//alert(data)
fetch_shoutmessage(data.shout);
levellist = data.levellist;
systemproduct = data.systemproduct;
systemproperty = data.systemproperty;
productingredient = data.systemproductingredient;
animalfeeding = data.animalfeeding;
farminfo = data.farminfo;
userproperty = data.user_property;
userproduct = data.user_product;
//gameMonitor();
obj.loadingScreen();
//obj.initOtherObj();
},
error: function(xhr, error, thrown)
{
alert(error);
}
})
},
this.loadingScreen = function()
{
//var imgs_count = 0;
//var num_loaded = 0;
$.each(systemproperty, function(v, row)
{
//imageLoadInfo.imgs_count++;
})
$.each(systemproduct, function(v, row)
{
imageLoadInfo.imgs_count++;
})
$.each(systemproperty, function(v, row)
{
//obj._loadingScreen('images/garden/property/' + row.prop_varname + '.png')
})
$.each(systemproduct, function(v, row)
{
obj._loadingScreen(row.product_varname, 'images/garden/product/' + row.product_varname + '.png')
})
}
this._loadingScreen = function(product_varname, img_src)
{
imgsObj[product_varname] = new Image();
imgsObj[product_varname].src = img_src;
imgsObj[product_varname].onload = function()
{
imageLoadInfo.num_loaded++;
//console.log( 'num_loaded = ' + imageLoadInfo.num_loaded + ' ' + img_src)
if ( imageLoadInfo.num_loaded == imageLoadInfo.imgs_count)
{
obj.initOtherObj();
}
var percent;
if ( imageLoadInfo.imgs_count > 0 )
{
percent = Math.ceil( ( imageLoadInfo.num_loaded * 100 ) / imageLoadInfo.imgs_count);
if ( percent > 100 ) percent = 100;
}
else
{
percent = 0;
}
$('#loadingscreen_text').html('?????????... '+ percent + '%')
$('#loadingscreen_percent').css('width', percent+'%');
$('#loadingscreen_value').html(imageLoadInfo.num_loaded + '/' + imageLoadInfo.imgs_count);
}
}
this.initOtherObj = function()
{
propertyObj = new Property();
propertyObj.initPropertyRecursive().initPropertyByGroup();
productObj = new Product();
productObj.initProductSource();
farmObj = new Farm();
farmObj.rebuild();
barnObj = new Barn();
barnObj.rebuild();
siloObj = new Silo();
siloObj.rebuild();
fieldObj = new Field();
fieldObj.rebuildField().rebuildOnplant();
animalObj = new Animal();
animalObj.rebuild();
machineObj = new Machine()
machineObj.rebuildMachine();
roadsideObj = new Roadside()
roadsideObj.rebuild();
soundObj = new Sound()
soundObj.init();
setTimeout(function(){ $('#loadingscreen').fadeOut() }, 1500)
}
obj.initGame();
var popup = new GardenPopup();
popup.showItemOptain('#worldmap', '<div style="margin: 0 auto; text-align:center;padding: 5px;color: #FFFFFF;font-weight: bold;font-size: 26px">??????????... ?????????????????????</div></div>', 'warning');
};
var Sound = function()
{
var obj = this;
this.init = function()
{
soundManager.setup({
url: '<?php echo $dir['js'] ?>/soundmanagerv297a-20130512/swf/',
// optional: use 100% HTML5 mode where available
//useHTML5Audio: true,
preferFlash: false,
onready: function() {
musicObj = {
bgMusic : soundManager.createSound({
id: 'bgMusic',
url: 'images/garden/music/bg_music.mp3',
volume: 15,
multiShot: false,
autoLoad: true,
onload: function(bSuccess) {
//console.log('sound bgMusic '+(bSuccess?'loaded!': 'did NOT load.'));
}
}),
buttonClick : soundManager.createSound({
id: 'buttonClick',
url: 'images/garden/music/button_click.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
levelUp : soundManager.createSound({
id: 'levelUp',
url: 'images/garden/music/level_up_03.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
addPlant : soundManager.createSound({
id: 'addPlant',
url: 'images/garden/music/add_fertilizer.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
collecting : soundManager.createSound({
id: 'collecting',
url: 'images/garden/music/collecting.mp3',
volume: 30,
multiShot: true,
autoLoad: true
}),
animals_chicken : soundManager.createSound({
id: 'animals_chicken',
url: 'images/garden/music/animals_chicken.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
animals_cow : soundManager.createSound({
id: 'animals_cow',
url: 'images/garden/music/animals_cow.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
animals_goat : soundManager.createSound({
id: 'animals_goat',
url: 'images/garden/music/animals_goat.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
animals_horse : soundManager.createSound({
id: 'animals_horse',
url: 'images/garden/music/animals_horse.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
animals_pig : soundManager.createSound({
id: 'animals_pig',
url: 'images/garden/music/animals_pig.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
animals_sheep : soundManager.createSound({
id: 'animals_sheep',
url: 'images/garden/music/animals_sheep.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
animals_cat1 : soundManager.createSound({
id: 'animals_cat1',
url: 'images/garden/music/cat_meow_demo_01.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
animals_cat2 : soundManager.createSound({
id: 'animals_cat2',
url: 'images/garden/music/cat_meow_demo_02.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
add_to_queue : soundManager.createSound({
id: 'add_to_queue_3',
url: 'images/garden/music/add_to_queue_3.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
gain_xp : soundManager.createSound({
id: 'gain_xp_temp_02',
url: 'images/garden/music/gain_xp_temp_02.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
bakery_door : soundManager.createSound({
id: 'bakery_door_1',
url: 'images/garden/music/bakery_door_1.mp3',
volume: 50,
multiShot: true,
autoLoad: true
}),
}
obj.loopSound( musicObj.bgMusic )
//musicObj.bgMusic.play()
},
ontimeout: function() {
// Hrmm, SM2 could not start. Missing SWF? Flash blocked? Show an error, etc.?
console.log( 'could not load sound manager 2' )
}
});
}
this.loopSound = function(sound) {
sound.play({
onfinish: function() {
obj.loopSound(sound);
}
});
}
}
var GardenPopup = function()
{
this.showItemOptain = function( target, htmlcontent, popupid)
{
var content = $('<div></div>');
content.css( { 'display': 'block', 'margin': '0 auto', 'width': '300px', 'height': '120px'} )
content.html( htmlcontent );
$(target).gardenpopup(popupid, content , { 'autohide' : false });
}
this.showItemMaking = function( target, htmlcontent, popupid)
{
var content = $('<div></div>');
content.css( { 'display': 'block', 'margin': '0 auto', 'width': '300px', 'height': '120px'} )
content.html( htmlcontent );
$(target).gardenpopup(popupid, content , { 'autohide' : false });
}
this.showAlert = function( target, htmlcontent, popupid)
{
var content = $('<div></div>');
content.css( { 'display': 'block', 'margin': '0 auto', 'width': '300px', 'height': '120px'} )
content.html( htmlcontent );
$(target).gardenpopup(popupid, content , { 'autohide' : false });
}
};
var GardenBubble = function()
{
this.showStar = function( target, htmlcontent, popupid, options)
{
var content = $('<div class="star_block"><div class="stroke-shadow-black">' + htmlcontent + '</div></div>');
$(target).gardenbubble(popupid, content , options);
}
this.showDiamond = function( target, htmlcontent, popupid, options)
{
var content = $('<div class="diamond_block"><div class="stroke-shadow-black">' + htmlcontent + '</div></div>');
$(target).gardenbubble(popupid, content , options);
}
this.showCoin = function( target, htmlcontent, popupid, options)
{
var content = $('<div class="coin_block"><div class="stroke-shadow-black">' + htmlcontent + '</div></div>');
$(target).gardenbubble(popupid, content , options);
}
this.showVoucher = function( target, htmlcontent, popupid, options)
{
var content = $('<div class="voucher_block"><div class="stroke-shadow-black">' + htmlcontent + '</div></div>');
$(target).gardenbubble(popupid, content , options);
}
this.showItemOptain = function( target, product, totaloptain, popupid, options)
{
var content = $('<div class="optain_block icon_' + product + ' bg_36x36"><div class="stroke-shadow-black">' + (totaloptain >= 0 ? '+': '' ) + totaloptain + '</div></div>');
$(target).gardenbubble(popupid, content , options);
}
};
var chatbox = function()
{
this.postTabPosition = function(tabname)
{
$.ajax({
type: "POST",
url: core_url,
data: "type=addmessage&shout_message=" + + '&last_shout_id=' + last_shout_id + '&position=' + shoutposition,
dataType: 'json',
error: function(e) {
alert(e)
},
success: function(data) {
}
});
}
};
var RandomWeight = function()
{
this.randomValue = function(samples, weights)
{
var weights_lenght = weights.length;
var samples_lenght = samples.length;
if ( weights_lenght != samples_lenght )
{
return null;
}
var sum = weights.reduce(function(a, b) { return a + b });
sum *= 100;
var rand = Math.floor((Math.random()* sum )+1);
var weights_lenght = weights.length;
for (var i = 0; i < weights_lenght; i++ )
{
var w = weights[i];
weights[i] = w * 100 + ( i > 0 ? weights[i-1] : 0 );
if ( rand <= weights[i] ) { return samples[i]; }
}
}
};
var Farm = function()
{
this.rebuild = function()
{
$('#farm_name').html(farminfo.farm_name);
$('#coin').html(farminfo.coin);
$('#diamond').html(farminfo.diamond);
$('#farm_level').html(farminfo.farm_level);
$('#voucher').html( parseInt(farminfo.greenvoucher) + parseInt(farminfo.bluevoucher) + parseInt(farminfo.pinkvoucher) + parseInt(farminfo.goldvoucher) )
var percent;
if ( farminfo.farm_exp_max > 0 )
{
percent = Math.ceil( ( farminfo.farm_exp_gain * 100 ) / farminfo.farm_exp_max );
if ( percent > 100 ) percent = 100;
}
else
{
percent = 0;
}
$('#exp_percent').css('width', percent+'%');
$('#experience_value').html(farminfo.farm_exp_gain+'/'+farminfo.farm_exp_max);
}
this.increaseExp = function(value)
{
musicObj.gain_xp.play();
farminfo.farm_exp_gain = parseInt(farminfo.farm_exp_gain) + parseInt(value);
farminfo.farm_exp_total = parseInt(farminfo.farm_exp_total) + parseInt(value);
return this.checkNextLevel();
}
this.checkNextLevel = function()
{
var isNextLevel = {};
//var levelinfo = levellist[ farminfo.farm_level ];
farminfo.farm_exp_gain = parseInt(farminfo.farm_exp_gain);
farminfo.farm_exp_max = parseInt(farminfo.farm_exp_max);
if ( farminfo.farm_exp_gain >= farminfo.farm_exp_max )
{
farminfo.farm_level++;
//console.log( farminfo.farm_level );
//console.log( levellist )
var nextlevel = levellist[ farminfo.farm_level ];
farminfo.farm_level = nextlevel.level;
farminfo.farm_exp_gain = ( farminfo.farm_exp_gain - farminfo.farm_exp_max);
farminfo.farm_exp_max = nextlevel.exp_next_level;
var addnewfield = levellist[ farminfo.farm_level ].max_fields - levellist[ farminfo.farm_level-1 ].max_fields;
if ( addnewfield > 0 )
{
new Property().addProperty('field', addnewfield);
new Field().rebuildField();
}
var _isNextLevel = $.extend({}, levellist[ farminfo.farm_level ]);
isNextLevel = _isNextLevel;
setTimeout(function()
{
musicObj.levelUp.play()
new GardenPopup().showAlert('#worldmap', '<div style="margin: 0 auto; text-align:center;padding: 5px;color: #FFFFFF;font-weight: bold;font-size: 26px">???????? ' + farminfo.farm_level + '</div><div style="margin: 0 auto; text-align:center" class="icon_diamond bg_64x64"><span style="display: none">' + farminfo.farm_level + '</span></div>', 'advancedtonextlevel_' + farminfo.farm_level );
}, 500)
}
this.rebuild();
return isNextLevel;
}
return this;
}
var Barn = function()
{
var obj = this;
this.rebuild = function()
{
this.sortProductByCount();
this.updateBarnCount();
var property = new Property();
barn = property.getProperty('barn');
barn = barn[1];
$('.barncount').html(barn.option_value2);
$('.barnstorage').html(barn.option_value);
$('.barnitemlist').html('')
var product = new Product();
product = product.getProduct();
product = product['product'];
$.each(product, function(k, row)
{
$('.barnitemlist').append('<a rel="' + row.product_varname + '" class="productitem"><div title="' + row.product_name + '" class="icon_' + row.product_varname + ' bg_48x48"></div><div class="stroke-shadow-black product_value_' + row.product_varname + '">' + row.product_count + '</div></a>');
})
$('.upgrate_silo').unbind('click').bind('click', function(e)
{
obj.upgrate();
e.preventDefault()
})
return this;
};
this.upgrate = function()
{
}
this.updateBarnCount = function()
{
product = new Product().getProduct();
var property = new Property();
barn = property.getProperty('barn');
barnInfo = barn[1];
barnInfo.option_value2 = 0;
$.each(product['product'], function(k, row)
{
barnInfo.option_value2 += parseInt( row.product_count );
})
barn[1] = barnInfo;
property.setProperty('barn', barn);
return this;
}
this.sortProductByCount = function()
{
var product = new Product();
var productInfo = product.getProduct();
var productBarn = productInfo['product'];
var array = [];
for ( k in productBarn )
{
array.push(productBarn[k]);
}
array.sort( this.sortByProductCountCallback );
productBarn = {};
$.each(array, function(k, val)
{
productBarn[ val.product_varname ] = val;
});
productInfo['product'] = productBarn;
product.setProduct('', productInfo);
return this;
}
this.sortByProductCountCallback = function(b, a)
{
var aVal = parseInt( a.product_count );
var bVal = parseInt( b.product_count );
return ((aVal < bVal) ? -1 : ((aVal > bVal) ? 1 : 0));
}
return this;
};
var Silo = function()
{
var obj = this;
this.rebuild = function()
{
this.sortProductCropByCount();
this.updateSiloCount();
var property = new Property();
silo = property.getProperty('silo');
silo = silo[1];
$('.silocount').html(silo.option_value2);
$('.silostorage').html(silo.option_value);
$('.siloitemlist').html('');
var product = new Product();
product = product.getProduct();
product = product['crop'];
$.each(product, function(k, row)
{
$('.siloitemlist').append('<a rel="' + row.product_varname + '" class="productitem"><div title="' + row.product_name + '" class="icon_' + row.product_varname + ' bg_48x48"></div><div class="stroke-shadow-black product_value_' + row.product_varname + '">' + row.product_count + '</div></a>');
})
$('.upgrate_barn').unbind('click').bind('click', function(e)
{
obj.upgrate();
e.preventDefault()
})
return this;
};
this.upgrate = function()
{
}
this.updateSiloCount = function()
{
product = new Product().getProduct();
var property = new Property();
silo = property.getProperty('silo');
siloInfo = silo[1];
siloInfo.option_value2 = 0;
$.each(product['crop'], function(k, row)
{
siloInfo.option_value2 += parseInt( row.product_count );
})
silo[1] = siloInfo;
property.setProperty('silo', silo);
return this;
}
this.sortProductCropByCount = function()
{
var product = new Product();
var productInfo = product.getProduct();
var productCrop = productInfo['crop'];
var array = [];
for ( k in productCrop )
{
array.push(productCrop[k]);
}
array.sort( this.sortByProductCountCallback );
productCrop = {};
$.each(array, function(k, val)
{
productCrop[ val.product_varname ] = val;
});
productInfo['crop'] = productCrop;
product.setProduct('', productInfo);
return this;
}
this.sortByProductCountCallback = function(b, a)
{
var aVal = parseInt( a.product_count );
var bVal = parseInt( b.product_count );
return ((aVal < bVal) ? -1 : ((aVal > bVal) ? 1 : 0));
}
return this;
};
.....
........
....... More...... Class here
})(jQuery);
var default_refresh_time = 30;
var core_url = '<?php echo createURL( array('module' => 'garden', 'mode' => 'index', 'ajax' => '1'),true, true) ?>';
var countdownlayout = '{sn} {sl}, {mn} {ml}, {hn} {hl}, and {dn} {dl}';
var countdownlayout_digits = '<b>{dn} {dl} {hnn}{sep}{mnn}{sep}{snn}</b> {desc}';
jQuery.noConflict();
jQuery(document).ready(function($){
$.countdown.setDefaults(
{
labels: ['Y', 'M', 'W', 'D', 'h', 'm', 's'],
// The expanded texts for the counters
labels1: ['Y', 'M', 'W', 'D', 'h', 'm', 's'],
}) // Set global defaults
$('#worldmap').garden();
$("#newspaperpage").booklet();
$.refreshMonitor.init(getChat);
$('.hidebutton').click(function(e)
{
//$(this).parent().hide();
//e.preventDefault()
})
//$('#testnumber').number(true, 0)
});
- hallsofvallhalla
- Site Admin
- Posts: 12026
- Joined: Wed Apr 22, 2009 11:29 pm
Re: where I can find the latest of tutorial for beginner
This will get you setup
http://indie-resource.com/forums/viewto ... 130&t=6945
I have more tutorials coming I have just been swamped.
http://indie-resource.com/forums/viewto ... 130&t=6945
I have more tutorials coming I have just been swamped.
- coolbloke1324
- Posts: 181
- Joined: Mon Jan 23, 2012 5:20 pm
Re: where I can find the latest of tutorial for beginner
That url is for version 1.0.0. You are running 1.1.1. And they are not compatible.danya0365 wrote:This page is very difference of my latest engine version ( http://www.isogenicengine.com/documenta ... structure/ )
I try to open and read the example file
but I don't know where should I start point from ???
I need to create new game isometric like HayDay on iOS
You can find links in your welcome email, on the isogenic website or on this forum in the tutorials post.