Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, Quad, 1 invisible), 601 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: 1 simple wait question [Re: DLively] #451123
04/28/15 20:51
04/28/15 20:51
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Wait is an implicit return from your function right then and there, so if for example the callee expects to see the side effects from its call, you need to defer the wait until after the side effects took place. Put in a different way that could mean that you have an action that moves an entity, but that will only ever happen after the first frame the action is called when putting the wait first.

Another example, just to show that waits don't necessarily are right at either end of the while, you might have a loop that in the first frame takes some data and pre-processes it, then comes a wait, and then it acts upon the data, followed by another wait and then it all starts again. So each frame it either pre-processes data or it acts based on the data.

Simply put, where it rights really does depend on what you do.
Edit: Looks like firo was faster

Last edited by WretchedSid; 04/28/15 20:53.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: 1 simple wait question [Re: WretchedSid] #451127
04/28/15 21:03
04/28/15 21:03
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
To make things clear, what I meant was something like this:
Code:
void hero(){
   while(my){ wait(1);
      my.skill1 = 10 * (key_w - key_s) * time_step;
      my.skill2 = 10 * (key_a - key_d) * time_step;
      my.skill3 = 0;
      c_move(my, nullvector, my.skill1, GLIDE);
   }
}

I still don't think that this is CORRECT way to write function to move entity. I wanted to aware DLively from teaching newbies to code things like this and etc.
Originally Posted By: 3run
Originally Posted By: DLively
I put my wait at the beginning for organizational purposes. It doesn't make any (real) difference in the way it runs.
Sure it does not, but it's not really a good way to organize your code, and I hope that you don't use such approach in your tutorials.

Cheers!
Cause from my own experience (and I do really have some! even if my knowledge base sucks) I know that this will lead to some troubles. I wouldn't recommend anyone to do so unless they are aware of what are they exactly doing and what are they teaching other to do! Sorry DLively, but you are still just learning (same as I do f.e.), so I don't really think that it is really safe for you or other newbies to play around with 'wait' unless you really want to use it for a purpose (placing it somewhere to get specific results!). But yeah, who am I to tell anything like this grin

Anyway, this discussion is really over for me, I don't want to bring this back. Just wanted to make my point clear!

Best regards


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: 1 simple wait question [Re: WretchedSid] #451128
04/28/15 21:21
04/28/15 21:21
Joined: Apr 2005
Posts: 1,988
Canadian, Eh
DLively Offline OP
Serious User
DLively  Offline OP
Serious User

Joined: Apr 2005
Posts: 1,988
Canadian, Eh
@SID @ FIRO: Okay grin Things are starting make more sense over here now.

Thank you everyone for all your help with this issue. laugh
I didn't want to be creating wrong code for myself, and (On top of that) share it too shocked

Cheers!
#AwesomeCommunity

Last edited by DLively; 04/28/15 21:24.

A8 Pro 8.45.4
YouTube: Create Games For Free
Free Resources: www.CGForFree.com
Page 2 of 2 1 2

Moderated by  old_bill, Tobias 

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