Browse Search Popular Register Upload Rules User list Login:
Oncollides as functions

screenshot of the scene

Author: TC42

Group: Default

Filesize: 16.91 kB

Date added: 2011-06-08

Rating: 5

Downloads: 415

Views: 684

Comments: 4

Ratings: 1

Times favored: 0

Made with: Algodoo before v1.8.5


Scene tag

You can substitute a function for an object's oncollide, because the oncollide of an object is a function. (Definition of a function: ()=>{}; oncollide: (e)=>{})
So here is a new way of calling functions without defining them with; it is phunlet friendly. I included some useful functions if you need them. If you can find a use for this, please tell me.
Last edited at 2012/07/08 20:03:04 by TC42
Please log in to rate this scene
Similar scenes
Title: Attraction Script Engine
Rating: 5
Filesize: 47.99 kB
Downloads: 244
Comments: 1
Ratings: 1
Date added: 2017/09/16 23:05:42
Made with: Algodoo v2.1.0
Rating: rated 5
Rating: 5
Filesize: 64.98 kB
Downloads: 349
Comments: 10
Ratings: 1
Date added: 2013/07/13 07:04:17
Made with: Algodoo v2.1.0
Rating: rated 5
Title: oncollide 2
Rating: 5.7
Filesize: 128.12 kB
Downloads: 857
Comments: 1
Ratings: 4
Date added: 2009/03/24 21:11:42
Made with: Phun
Rating: rated 5.7
Title: Tactical Nuke [Phunlet]
Rating: 5.625
Filesize: 64.35 kB
Downloads: 3966
Comments: 5
Ratings: 2
Date added: 2012/09/07 19:44:52
Made with: Algodoo v2.0.1
Rating: rated 5.6
Title: Strings functions (Thyme)
Rating: 5.625
Filesize: 1.86 kB
Downloads: 261
Comments: 1
Ratings: 2
Date added: 2010/02/27 22:12:21
Made with: Algodoo before v1.8.5
Rating: rated 5.6
Title: onCollide
Rating: 8.5018
Filesize: 42.45 kB
Downloads: 5450
Comments: 16
Ratings: 27
Date added: 2009/03/22 01:21:15
Made with: Phun
Rating: rated 8.5
Yay! The best method of hacking Thyme since the New Method!

Also, could you explain My GUI is spazzing out again (you know what I mean), so I can't really use the box to read off of, so I tried to use the Appearance menu, but I realized that I simply didn't understand the function at all. = (a, b, x, y, point, T, F) =>
{{(((point(0) - x) ^2) /a^2) + (((point(1) - y)^2)/b^2) <= 1} ? {T} : {F}}

What are a, b, x, and y?

Are a and b the max and min radius, x and y are the coordinates of the center?
You know, I haven't even memorized what the values of that function do, and I wrote it! *checks legal pad with notes on it*

Okay, so the formula to graph an ellipse is 1=(x-x1)^2/A^2 + (y-y1)^2/B^2
Link to equations
So if you graph it (using a graphing calculator, preferably), A is horizontal width of the ellipse, and B is the vertical width of the ellipse. X1 and Y1 are the xy coords of the center of the ellipse. See for yourself

All the function does is replace the = with <=, to check if a point is in an ellipse, rather than to graph one.

So yes, for the most part, you guessed correctly. :tup:
Last edited at 2011/06/09 15:13:23 by TC42 = (size, pos, point, T, F)=>{{(((point(0) - pos(0))^2 / size(0)) + ((point(1) - pos(1))^2 / point(1))) <= 1} ? {T} : {F}}

Hmm... Nope. Doesn't work. I don't know.

However, renaming yours does work: = (size, pos, point, T, F) =>
{{(((point(0) - pos(0)) ^2) /size(0)^2) + (((point(1) - pos(1))^2)/size(1)^2) <= 1} ? {T} : {F}}

Ah, now I get it. The denominators are suppost to be squared. How did I miss that...:bonk:
:s huh? Wish I knew c.
Last edited at 2011/07/05 00:10:01 by FuzzyLogicBrain