Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
how to change mouse cursor in coppercube??

integer.parsenet
Guest
Quote
2016-04-03 21:41:23

Hey guys! I am very new to coppercube and javascript... Trying out the demo version and creating a simple click and play game, i want to change the mouse cursor for my game

Any ideas on how to do this??

Please please! Tell me.... If you know how to change the cursor.

And there is one more thing how to make an object follow another object ??

And how to set position near to an object on pressing a specific key?

Any help regarding this will be appreciated....


niko
Moderator
Quote
2016-04-04 08:09:08

You can change the cursor in Windows .exe and Mac OS X app by making it invisible and drawing an image at its place. But you'd need scripting for this. Like this:

function onFrameDrawing()
{
// draw a red, transparent rectangle at the position of the mouse
var mouseX = ccbGetMousePosX();
var mouseY = ccbGetMousePosY();

ccbDrawColoredRectangle(0x77ff0000, mouseX-10, mouseY-10, mouseX+10, mouseY+10);
}

ccbRegisterOnFrameEvent(onFrameDrawing);


You mean how to make an AI object follow another object? There is the scripting function "ccbAICommand". You could continuously tell an AI to move to the position of the object it should follow.


just_in_case
Moderator
Quote
2016-04-04 18:51:10

Instead of drawing a red rectangle isn't there any way to use a image as mouse cursor...


just_in_case
Guest
Quote
2016-04-05 08:27:48

Got it, all i was need to is to read documentation carefully... Using a texture rectangle with alpha has just sort out my problem...

@integer.parsenet you should also use a textured rectangle with alpha if u want to use custom cursor image.


erik
Registered User
Quote
2016-04-05 08:29:10

Yes, use it like this:
 ccbDrawTextureRectangle("someFile.png", mouseX-100, mouseY-100, mouseX+100, mouseY+100);



pmax
Registered User
Quote
2016-04-05 10:45:35

If you want to use an image with alpha channel!
ccbDrawTextureRectangleWithAlpha("someFile.png", mouseX-100, mouseY-100, mouseX+100, mouseY+100);



just_in_case
Moderator
Quote
2016-04-05 19:11:45

Dont forget to change the value of x-100,y-100,x+100,y+100 to a small one if you dont want your cursor to be oversized dude...


techno-valley
Registered User
Quote
2016-04-09 02:35:15

Excellent topic.

You may change the cursor size as well by changing the mouseX-100 value to mouseX-200 to double the mouse cursor size for example in addition to the other parameters.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Interna?ional" (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