Sami Tervo |
ive read many tutorials and different topics which contain some information of agimouse, but i havent found answer to my question. in my project there would be point and click to shoot- system in combats. i was wondering, is there any command/syntax-for determining ,has player clicked on e.g. object 4? or do i have to do it by the hard way like getting object 4's x&y with get posn-stuff and then but code that checks is the click within some area (based on object 4's x&y-coordinates) |
AGI1122 | Sorry but there is not a command for seeing if the user click on an object, you will have to get the coordinates to try to see if the user clicked on it or not. |
Sami_Tervo |
:P,well i managed to get it work quite easily, but multiple enemies might cause som probs due to blending of clicking areas. but i ran into bigger problem; i wanna regulate how much can object move within 'turn',because combat would be turn-based (just like in fallouts). i have faint vision of creating somekind get(posn)-system again, but thats all what i got. i thought if someone of you could create somekind of plan, or even better, quote code how to do that. |
AGI1122 |
well i managed to get it work quite easily, but multiple enemies might cause som probs due to blending of clicking areas.There is a simple way around this. Check to see the enemy's Y coordinates and X coordinates. If the X coordinates are around the same numbers then have it compare the Y coordinates to see which one is closer to the screen. Then only let it shoot the one that is up closer. |
Andrew Baker |
Wouldn't you have to justify the view's x,y (the left bottom corner of the view by default?) with an if obj.in.box(view_x, view_y+view_height,view_x+view_width, view_y) { ... Is this correct, or am I making a mistake"? |
Andrew Baker |
I had an idea about turn-based combat.... First, set a limit to the number of fighters you can have. This is due to limitations in the number of objects, etc. but moreover because of the lack of dynamic allocation. Anyway, let's assume 2 characters for the sake of argument. First, determine initiative. This is the order the characters will move. However you did this makes no difference as long as the result is expressed in an integer variable within the set of {0... max characters}. Second, you can then initialize the characters. I believe that would look something like: if(cur_turn == char_init) { //for AI Labelnot_done: distance(ego, bad_guy, vD); if (vD<==range_of_weapon && movement>== movement_needed_to_attack) { //Attack //movement cost } if (vD>range_of_weapon || movement<movement_needed_to_attack) { //Move towards ego //Movement cost } if (movement == 0) { cur_turn == cur_turn+1; } else {goto(Labelnot_done);} } if (cur_turn == ego_init) { //for Player Labelego_not_done: distance(ego, bad_guy, vD); distance(ego, mouse_cursor, vD2); if (movement>0) { if (vD2<==movement && Left_Clickon_Mouse) { //Move player //Movement cost } if (vD<==range_of_weapon && movement>==movement_needed_to_attack && Right_Clickon_Mouse) { //Attack //Movement Cost } goto(Labelego_not_done); } else {cur_turn = cur_turn +1;} } One of these will be needed for each character, I think. I don't know, but I thought maybe this might help. By the way, AGI Studio turns "for" blue as if it was a reserved keyword, but I've never found any mention in the help documentation or FAQs about a for command. This would allow for an even easier turn-based game. Anyway, I hope it helps some. |
Sami_Tervo | :D thanks !! this will help me alot, now when hardest part is behind i can focus in the game itself again. |
AGI1122 | What I am talking about is approximation not exact form of telling if they are in front. obj.in.box would be really hard to use because you would have to set up a box everywhere on the screen, which is not really fun or easy to do. Plus it would be harder to do it that way in the first place. You have to realise that he said multiple enemies would be on the screen so checking there x position first to see if they are close then if they are check to see if the y positions are close too and if they are only let the interpreter shoot the bad guy with the higher y position. |
Andrew_Baker | You're right about obj.in.box. I found out the hard way that one cannot use variables as arguments (so it's only for static triggers), while writing my pushing objects code. |