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: 536

Views: 288

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: Blunting frog
Rating: 5
Filesize: 45.86 kB
Downloads: 921
Comments: 3
Ratings: 1
Date added: 2009/04/01 13:58:27
Made with: Phun
Rating: rated 5
download
Title: Jake the frog
Rating: 5
Filesize: 196.45 kB
Downloads: 940
Comments: 0
Ratings: 1
Date added: 2023/08/16 05:45:41
Made with: Algodoo before v1.8.5
Rating: rated 5
download
Title: Purple frog
Rating: 5
Filesize: 12.92 MB
Downloads: 465
Comments: 0
Ratings: 1
Date added: 2025/08/20 21:58:56
Made with: Algodoo v2.2.4
Rating: rated 5
download
Title: Jack the frog
Rating: 5
Filesize: 1.29 MB
Downloads: 1295
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: 1387
Comments: 3
Ratings: 1
Date added: 2014/03/13 17:57:43
Made with: Algodoo v2.1.0
Rating: rated 5
download
Title: FROGGER
Rating: 6.1111
Filesize: 446.38 kB
Downloads: 2791
Comments: 9
Ratings: 3
Date added: 2013/06/09 06:34:16
Made with: Algodoo v2.1.0
Rating: rated 6.1
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