Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (dr_panther, 1 invisible), 643 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Mouse Click #404408
07/08/12 17:39
07/08/12 17:39
Joined: May 2010
Posts: 41
İstanbul/Turkey
Sorrowful Offline OP
Newbie
Sorrowful  Offline OP
Newbie

Joined: May 2010
Posts: 41
İstanbul/Turkey
Code:
if(mouse_left==1)
   {
   	ent_animate(me,"5atak",ates_per,ANM_CYCLE);
   	ates_per += 1*time_step;
   }



I want to be when I click the mouse once...


A8.40 Professional
Sancak Oyun Ekibi
Re: Mouse Click [Re: Sorrowful] #404409
07/08/12 17:47
07/08/12 17:47
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Do u call it from a while loop ?
Do u want to execute it only one time ?


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Mouse Click [Re: Sorrowful] #404410
07/08/12 17:52
07/08/12 17:52
Joined: Mar 2011
Posts: 3,150
Budapest
sivan Offline
Expert
sivan  Offline
Expert

Joined: Mar 2011
Posts: 3,150
Budapest
it's okay, if placen in a while(1) loop having wait(1) in the end , but if(mouse_left) is enough.


Free world editor for 3D Gamestudio: MapBuilder Editor
Re: Mouse Click [Re: sivan] #404412
07/08/12 18:03
07/08/12 18:03
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
If "5atak" means attack. Then this wont work in a simple while. Cause the attack animation only would be played when holding mouse_left. I think (without knowing it, cause of no informations) he want to have a kind of a oneshot-animation.

Last edited by rayp; 07/08/12 18:04.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Mouse Click [Re: rayp] #404429
07/09/12 04:47
07/09/12 04:47
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
i think this could work:
Code:
var hitleft = 0;
...

if(mouse_left==1 && hitleft ==0)
{
	hitleft = 1;
	ates_per = 0;
   	while(ates_per<99)
	{
		ent_animate(me,"5atak",ates_per,ANM_CYCLE);
   			ates_per += 1*time_step;
		wait(1);
	}
	ates_per = 100;
	ent_animate(me,"5atak",ates_per,ANM_CYCLE);
	hitleft = 0;
}



bit i think you should use me.skillXX instead of ates_per.. cause a global variable as frame counter is not effective in greater scenes with more animations laugh

Last edited by Espér; 07/09/12 04:48.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Mouse Click [Re: Espér] #404431
07/09/12 06:15
07/09/12 06:15
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Yeah but when using this code, the main-while is paused until the animation is done. If he does further movement fex in the main while, this wont work. And why do u use ent_animate again after the while ?

whats about this one. Full animation played from main-while without pausing it.
Code:
#define Satack   skill100
#define ates_per skill99

function anm_me()
{
  while(my)
  {
    if(my.Satack == 1) { my.ates_per += time_step; ent_animate(me, "Satak", my.ates_per, ANM_CYCLE); }

    if(my.ates_per >= 100) { my.ates_per = 0; my.Satak = 0; }
    wait(1);
  }
}

action The_Player()
{
  anm_me();
  while(my)
  {
    if(mouse_left && my.Satack == 0) my.Satack = 1; 
    //further code in main while like movement whatever
    wait(1);
  }
}


Now if mouse_left is pressed the full animation will be displayed without pausing the main-while.

mfg

Last edited by rayp; 07/09/12 06:15.

Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Mouse Click [Re: rayp] #404432
07/09/12 06:29
07/09/12 06:29
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
would be an idea..
but only if you got 1 or 2 animated models at a time.. if there will be more, with different pointer names.. the main loop won't work.. the animation needs ro be in the entities action

my code is not meant to be in the main loop. it's coded to be part of the entities action smirk


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Mouse Click [Re: Espér] #404433
07/09/12 06:34
07/09/12 06:34
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
Quote:
but only if you got 1 or 2 animated models at a time.. if there will be more, with different pointer names.. the main loop won't work.. the animation needs ro be in the entities action
This is not true. With this code above u can have 1000 of entitys. Which pointers ? It only uses "my" called from each entity. So this script above works with ALL The_Player actions in game.


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;
Re: Mouse Click [Re: rayp] #404434
07/09/12 06:36
07/09/12 06:36
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
ah
i see
sry - misunderstood the script ^_^" - forget whatever i said


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: Mouse Click [Re: Espér] #404435
07/09/12 06:39
07/09/12 06:39
Joined: Jul 2008
Posts: 2,107
Germany
rayp Offline

X
rayp  Offline

X

Joined: Jul 2008
Posts: 2,107
Germany
no problem thanks for thinking with me to solve the problem. But the threadstarter seems not really interested ^^


Acknex umgibt uns...zwischen Dir, mir, dem Stein dort...
"Hey Griswold ... where u gonna put a tree that big ?"
1998 i married my loved wife ... Sheeva from Mortal Kombat, not Evil-Lyn as might have been expected
rayp.flags |= UNTOUCHABLE;

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1