PDA

View Full Version : hunter and friends



lydia_sp
07-08-2009, 18:42
hi all,

I place my example new here. I am interesting to know how I can calculate distant movement between hunter and prey :) I will program this part code alone, try it. need only advice. nice evening to all guys here, I am alone in the dark as female venus girl ? I plan step by step to learn tbgl, it`s so much to learn, unbelievable! my idea increases with hunter and prey (it`s a good start for me to learn!), good to see. funny to program my first scene with tbgl, all new everything. thank you for help to all until today.

best regards, lydia

postscriptum: I hate sometime my old pc, my keyboard, my mouse, my linux. makes a lot of trouble last days. will buy a new robot machine with more power.

see more about my first example here:
http://community.thinbasic.com/index.php?topic=2814.msg21421;topicseen#new

Michael Hartlef
08-08-2009, 11:47
Would an algorithm like this depend strongly on the environment?

Lionheart008
08-08-2009, 17:53
hi lydia, short...
perhaps this could help... distance calculation between points and lines for example looks like this one:


PRINTL SQR((ABS(x1 - x2) ^ 2) + (ABS(y1 - y2) ^ 2))
"ABS" isn't necessary

otherwise you can do it without a formula, you have already the "collides" function from petr so I can imagine it must be run in this kind with entities and substraction commands like above line you can see... but I am not sure... my little advice, nice week-end, I am quitting here now by logging off...

lionheart
ps: good luck with your first tbgl example. looks nice your script, I am curious to see more. it's always hart at the beginning to get a good overview about all tbgl features :)

lydia_sp
10-08-2009, 17:54
hello mr. lionheart, michael, thank you for reply. ok. I see ;) I will do my script withouth forumula. not necessary, you are right. Haven`t had time enough to search better solution. I will try new script this week. I am interested in collisions and particle examples! saludo, lydia

lydia_sp
11-08-2009, 19:21
hello. here my solution. distance and angle degree. perhaps somebody can test the script, don`t know if this script is allright, I hope so ! I am open to learn and hear critics. worked at the pc of my dad, winxp! I took last update of thinbasic. greetings :)

Petr Schreiber
11-08-2009, 19:38
Hi Lydia,

your script is fine, but you had there one "terrible secret" - you had TBGL_Translate used between TBGL_BeginPoly / TBGL_EndPoly on multiple places.

As help file says, between those two commands, only the following is allowed:

TBGL_Color
TBGL_ColorAlpha
TBGL_TexCoord2D
TBGL_Normal
TBGL_Vertex

So you should move the TBGL_Translate before TBGL_BeginPoly.

To check your code for validity, simply use TBGL_GetLastGLError, if it returns empty string, everything is allright.
If it does not, it should contains description of the error.


Petr