Mouse over effects

About advanced scenes, and the Thyme scripting language used in Algodoo.

Mouse over effects

Postby Kilinich » Thu Jan 05, 2012 3:53 pm

It can be used for various visual effects or more complex interface/scripts.

Just select code and paste it into geom's script window. You can do it for few selected geoms too.

Script for cirlces:
Code: Select all
_color = color;
_mouseOverCircle = {
    circle := readable(owner);
    r := circle.radius;
    d := circle.pos - app.mousepos;
    r * r > d(0) * d(0) + d(1) * d(1)
};
color = {_mouseOverCircle ? (owner._color * [2, 2, 2, 1]) : owner._color}


Script for boxes:
Code: Select all
_color = color;
_mouseOverBox = {
    box := readable(owner);
    a := box.angle;
    m := box.pos - app.mousepos;
    mx := (math.cos(a) * m(0) + math.sin(a) * m(1));
    my := ( - math.sin(a) * m(0) + math.cos(a) * m(1));
    dx := box.size(0) / 2;
    dy := box.size(1) / 2;
    mx * mx < dx * dx && my * my < dy * dy
};
color = {_mouseOverBox ? (owner._color * [2, 2, 2, 1]) : owner._color}


Demo scene:
Rating: rated 5.6
Filesize: 37.86 kB
Comments: 0
Ratings: 2
download
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Mouse over effects

Postby Nait » Thu Jan 05, 2012 4:02 pm

Nicely done. In your style of high-level programming. Optimization and so on...
And i suppose no one to use this ever. As well as your other great achievement in scripting.
User avatar
Nait
 
Posts: 224
Joined: Fri Oct 30, 2009 1:56 am
Location: Eastern Russia, Vladivostok

Re: Mouse over effects

Postby Kilinich » Thu Jan 05, 2012 4:23 pm

Nait wrote:And i suppose no one to use this ever. As well as your other great achievement in scripting.


It's ok, I get used to this ;-) no players left, forum dead, algobox full of crap, and half scenes lost :twisted:

I've post it here for myself - it's easier to find scripts here than on my pc inside some scenes. :thumbup:
Last edited by Kilinich on Fri Jan 06, 2012 8:34 pm, edited 1 time in total.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Mouse over effects

Postby Nait » Thu Jan 05, 2012 4:33 pm

Kilinich wrote:It's ok, I get used to this ;-) no players left, forum dead, algobox full of crap, and half scenes lost :twisted:

I've post it here for myself - it's easier to find scripts here then on my pc inside some scenes. :thumbup:

It may be weird chance, but our scenes and mine of one period are recovered differently. Meaning - most of yours are and mine are not at all.
lol

Ps, hard case of necroposting...
User avatar
Nait
 
Posts: 224
Joined: Fri Oct 30, 2009 1:56 am
Location: Eastern Russia, Vladivostok

Re: Mouse over effects

Postby Kilinich » Thu Jan 05, 2012 7:32 pm

It's not recovered, I've re-post all of them. Just like wildbill did.
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Mouse over effects

Postby s_noonan » Fri Jan 06, 2012 2:12 am

Keep posting scenes and showing code in the forum. They are very helpful to us who are still learning. Even if we don't use the exact code, they help us understand coding and may help spawn new ideas.
s_noonan
 
Posts: 61
Joined: Tue Mar 30, 2010 2:25 am

Re: Mouse over effects

Postby Xray » Tue Dec 18, 2012 9:18 am

I agree with s_noonan. Most of Kilinich's code is over most of our heads (and I think I speak for most everyone in this forum) but it shows us what CAN be done if one wants to put forward the effort and dedication to learn more advanced techniques. I'm just mystified by some of these scripts that Kilinich comes up with, and I wish I knew where he gets this stuff from. You cannot learn those complex scripts and new techniques that no one else knows anything about by reverse-engineering other people's code! So, he must be getting this stuff from a "secret source" that he won't admit to. Maybe he has a direct comm line to Emil (?), I don't know. Whereever he gets it from remains a secret that he apparently will not compromize.
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Mouse over effects

Postby Kilinich » Tue Dec 18, 2012 10:06 am

Actually, Emil saw my jackhammer scene and said something like that:

...vertex collisions and the such in Thyme.... you are a masochist =)
omg, qSortTable you are crazy".


So.. no magic no secret sources. I'm just older than you and algodoo is my hobby. :ugeek:
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Mouse over effects

Postby Xray » Tue Dec 18, 2012 7:18 pm

Kilinich wrote:Actually, Emil saw my jackhammer scene and said something like that:

...vertex collisions and the such in Thyme.... you are a masochist =)
omg, qSortTable you are crazy".


So.. no magic no secret sources. I'm just older than you and algodoo is my hobby. :ugeek:


Kilinich - Please rest assured that what I said, I said out of respect and envy. You are obviously an expert software engineer, and those of us who enjoy programming but who do not have your level of exertise can only marvel at the things you come up with! My hat goes off to you, sir!

BTW - Are you so sure that you are older than I am??? ;)
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Mouse over effects

Postby Kilinich » Wed Dec 19, 2012 9:40 am

Xray wrote:BTW - Are you so sure that you are older than I am??? ;)

Yes, only Wild bill can compite me in that :D
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Mouse over effects

Postby Xray » Wed Dec 19, 2012 9:54 am

Kilinich wrote:
Xray wrote:BTW - Are you so sure that you are older than I am??? ;)

Yes, only Wild bill can compite me in that :D


Are you older than 65?
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Mouse over effects

Postby Xray » Sun Feb 03, 2013 8:07 am

Hmmmm.... still no answer to my last question! :lol:

Hey, Kilinich.... Is there a way you could make the mouseover effect work with polygons?
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA

Re: Mouse over effects

Postby Kilinich » Sun Feb 03, 2013 10:06 am

Xray wrote:Hmmmm.... still no answer to my last question! :lol:

Hey, Kilinich.... Is there a way you could make the mouseover effect work with polygons?


Huh? Done already. I saw your even comment that scene :wtf:
Rating: rated 5
Filesize: 5.09 kB
Comments: 2
Ratings: 1
download
Dream of Algodoo as game development engine...
User avatar
Kilinich
[Best bug reporter 2010]
 
Posts: 2098
Joined: Mon Aug 31, 2009 8:27 pm
Location: South Russia

Re: Mouse over effects

Postby Xray » Mon Feb 04, 2013 6:31 am

Yes, I remember that scene. Your script is vastly different between the polygon version and the box and circles versions, and so I did not mentally tie the two (poly and non-poly) versions together. Of course they have to be very different because polygons are very different from simple circles and boxes. You did a great job (as usual) on both versions. I've learned more from your scenes than from any other source in the forums or in Algobox. Thank you for your informative contributions to the Algodoo community. :clap:

BTW - The "question" that I was referring to was the one about age. I asked you if you are older than 65 and you did not answer me. So, I assumed that for whatever reason, you did not want to answer that question. ;)
User avatar
Xray
 
Posts: 501
Joined: Sun Jun 17, 2012 6:12 am
Location: USA


Return to Thyme scripting

Who is online

Users browsing this forum: No registered users and 2 guests