Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Announcements and Showcase
RTS Game Template

alfakilo
Registered User
Quote
2019-01-12 22:40:36

Very nice template..thanks for shareing.

In file behavior_rtsGameController.js




For the selection i added code for rectangle:To draw rectangle

//all directions
if (mX<=mouseX && mY<=mouseY )
{
ccbDrawColoredRectangle(0x444BC050, mX, mY, mouseX, mouseY);
}
if (mX<=mouseX && mY>=mouseY )
{
ccbDrawColoredRectangle(0x444BC050, mX, mouseY, mouseX, mY);
}
if (mX>=mouseX && mY<=mouseY )
{
ccbDrawColoredRectangle(0x444BC050, mouseX, mY, mX, mouseY);
}
if (mX>=mouseX && mY>=mouseY )
{
ccbDrawColoredRectangle(0x444BC050, mouseX, mouseY, mX,mY);
}



TO SELECT UNITS i added this.All directions.

//if (this.isPointInside(point.x, point.y, mX, mY, mouseX, mouseY))
//if (this.isPointInside(point.x, point.y, mouseX, mouseY ,mX, mY))
//if (this.isPointInside(point.x, point.y, mX, mouseY, mouseX, mY))
//if (this.isPointInside(point.x, point.y, mouseX, mY ,mX, mouseY))



//////check2

if (this.isPointInside(point.x, point.y, mouseX, mouseY ,mX, mY))
{
// select units
ccbSetSceneNodeProperty(circle, 'Visible', true);
// show property background if hidden
ccbSetSceneNodeProperty(this.PropertyBackground, 'Visible', true);

// check if there is other unit types within the selection rectangle than just worker
var name = ccbGetSceneNodeProperty(this.SelectedUnit, 'Name');
if (name == "Army")
hasarmy = true;
// show the property image of the unit according to unit type
this.showSelectedUnit(ccbGetSceneNodeProperty(this.SelectedUnit, 'Name'));

}


areibma
Registered User
Quote
2019-10-08 11:07:36

Thanks. I have added some more controls of workers but could not update the files. I had an accident last year in August 28 and was in ICU for 8 days. Still recovering. I will post updates when I will recover.

Regards


morice.cube
Registered User
Quote
2019-12-24 19:35:23

Great !


Guest
Guest
Quote
2023-05-09 20:12:16

Thanks for sharing, anyone tried using this for a full fledged rts game?


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inte?national" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact