jeromeetienne / blockly-threex

a blockly able to do webgl thru three.js
http://jeromeetienne.github.io/blockly-threex
29 stars 7 forks source link

Obstacles #7

Open randompast opened 10 years ago

randompast commented 10 years ago

There should be various barriers which freeze the blockly script if the player collides with them. Ex: Spikes, Ladders, pits, monsters (static or roaming)...

This should probably include stuff like: detectNearestObstacle()

while{ obstacle = detectNearestObstacle() if (distance(obstacle.position, player.position) < move.length){ switch(obstacle.type){ case spikes: avoid() case gap: prepareJump() case ladder: climb() case monster: object.type.difficulty < player.level ? fight() : run() } } }

Eh, you get the idea, might be annoying to figure out how to detect the stuff best.

jeromeetienne commented 10 years ago

i love the idea. i had the same to be honest. but as of now, the program is run async.... it is rather hard to explain via github. in very short, every instruction is run, pushed in a stack, then unstacked.

This is the way it is done in blockly examples. i just copied. it was easy but limited

this is a strong limitation that i would like to remove as it prevents interactivity between bots

randompast commented 10 years ago

I don't know much about them, but could something like webworkers solve this issue?