Browse Search Popular Register Upload Rules User list Login:
Search:
Inteligent Frog

Image:
screenshot of the scene

Author: vinodrai

Group: Educational

Filesize: 1.38 MB

Date added: 2021-11-16

Rating: 5.5

Downloads: 362

Views: 189

Comments: 3

Ratings: 2

Times favored: 0

Made with: Algodoo v2.1.0

Tags:
projectile,
frog,
trajectory,
educational,
physics

Scene tag

The path followed by a projectile is called its trajectory. If we negligible air resistance, projectiles follows a
curved trajectory or curved path that is a parabola. Click to see frog jumping at most optimal trajectory.

Version 2.0 with frog and you mode...
Last edited at 2021/11/17 13:04:06 by vinodrai
Please log in to rate this scene
edit
Similar scenes
Title: Dancing Frog
Rating: 6.6
Filesize: 39.21 kB
Downloads: 317
Comments: 6
Ratings: 5
Date added: 2008/10/16 11:17:46
Made with: Phun
Rating: rated 6.6
download
Title: Jake the frog
Rating: 5
Filesize: 196.45 kB
Downloads: 637
Comments: 0
Ratings: 1
Date added: 2023/08/16 05:45:41
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: Frog jumper.. WIP
Rating: 5.5556
Filesize: 12.01 kB
Downloads: 839
Comments: 6
Ratings: 3
Date added: 2009/10/13 19:06:51
Made with: Algodoo before v1.8.5
Rating: rated 5.6
download
Title: Jack the frog
Rating: 5
Filesize: 1.29 MB
Downloads: 826
Comments: 0
Ratings: 1
Date added: 2023/08/13 21:52:19
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: Life-Frog
Rating: 5
Filesize: 34.43 kB
Downloads: 1221
Comments: 3
Ratings: 1
Date added: 2014/03/13 17:57:43
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: Vector Physics
Rating: 5
Filesize: 19.33 kB
Downloads: 647
Comments: 0
Ratings: 1
Date added: 2009/06/03 23:40:29
Made with: Phun
Rating: rated 5
download
Nice work.:tup:
This is a good scene with nothing really wrong with it, but I'm going to pick on the code anyway in order to show an example of variable initialization and scope. The following refers to the postStep code in the frog. The present code has (11) "e.this.", (52) "scene.my.", and (0) ":=". The revised code has (0) "e.this.", (17) "scene.my.", and (9) ":=".

To change the code, enter the following in the upper left hand text box of the frog Script widget:
_jumpdelaytime := 0.0;
_frogvel := 0.0;
_randint := (min, max)=>{
min + math.toInt(rand.uniform01 * (max - min))
};

Then change the postStep code to:
(e)=>{
angle >= math.pi * 0.1 ? {
angle = math.pi * 0.1
} : {};
angle <= - math.pi * 0.1 ? {
angle = - math.pi * 0.1
} : {};
frogpos := pos - [0, size(1) / 2];
targetdistance := ((scene.my.targetpos(1) - frogpos(1)) ^ 2 + (scene.my.targetpos(0) - frogpos(0)) ^ 2) ^ 0.5;
targetangle := math.atan((scene.my.targetpos(1) - frogpos(1)) / (scene.my.targetpos(0) - frogpos(0)));
scene.my.playbutton == 1 ? {
_jumpdelaytime = sim.time;
scene.my.stonehit = 0
} : {};
sim.time >= _jumpdelaytime + 0.01 && sim.time <= _jumpdelaytime + 0.02 ? {
vel = _frogvel;
angle = - 0.05
} : {};
mousedistance := ((app.mousepos(0) - pos(0)) ^ 2 + (app.mousepos(1) - pos(1)) ^ 2) ^ 0.5;
mouseangle := math.atan((app.mousepos(1) - frogpos(1)) / (app.mousepos(0) - frogpos(1)));
heightdiff := scene.my.targetpos(1) - frogpos(1);
horidiff := scene.my.targetpos(0) - frogpos(0);
jumpangle := math.atan((heightdiff + targetdistance) / horidiff);
jumpvectorvel := (sim.gravitystrength * (heightdiff + targetdistance)) ^ 0.5;
scene.my.mode == 1 ? {
_frogvel = [jumpvectorvel * math.cos(jumpangle), jumpvectorvel * math.sin(jumpangle)]
} : {
_frogvel = [scene.my.inputvelocity * math.cos(scene.my.inputangle * math.pi / 180), scene.my.inputvelocity * math.sin(scene.my.inputangle * math.pi / 180)]
};
sim.time >= scene.my.spawndelay + 1.0 && sim.time <= scene.my.spawndelay + 1.005 && scene.my.stonehit == 1 ? {
pos = [_randint(1, 46), 1.0];
scene.my.stonepos = [_randint(56, 63), _randint(3, 24)]
} : {}
}
Thanks Sir,

I will first understand and will sure implement. It will help me to simpify my codes in future too !! I need to learn it correct way because I propose to introduce coding to young students from high school and coach them too. Thanks