Game Development Community

Simple Coding Logic

by rennie moffat · in Torque Game Builder · 07/20/2009 (6:55 am) · 12 replies

HI,
I am relative newbie and I have a quick question perhaps someone can help clarify for me better as to why it is as it is

function PlayerClass::executeShootAnimationState(%this)
{
if ( !%this.Alive )
{
return "die";
}



Regardless of what is being done here, it always seems a bit backwards to me, Specifically the second and third line. Why if "this is alive", do I return it dead. Am I missing something, please help run it thru this brain as to why that is.

About the author

My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.


#1
07/20/2009 (6:58 am)
The ! in front of %this.Alive negates it.

Think of ! the same as "not". example: !true = false --> "not true equals false"

Patrick
#2
07/20/2009 (7:15 am)
right, so its saying if this is NOT alive then return DIE
#3
07/20/2009 (7:31 am)
oh i see, thanks guys.



Sorry for being so dumb on this, still learning.


Cheers!
#4
07/20/2009 (7:57 am)
!dumb :)

Beginner questions are welcome, that's what the forums are for.
#5
07/20/2009 (8:37 am)
Spanks.



!hateYou
#6
07/20/2009 (2:00 pm)
lolz... good reading.
#7
07/20/2009 (2:48 pm)
how are you gonna know unless you ask...at least you ask nicely unlike that Fernando fella
#8
07/20/2009 (3:20 pm)
yah screw that fernando guy.







: im joking I don't know who he is.
#9
07/20/2009 (3:37 pm)
Haven't gotten to the point where I am asking these types of the questions... but it did cross my mind! Good to know. :)
#10
07/20/2009 (4:47 pm)
Come on guys... Fernando's pissed about something - that's for sure - and could communicate better but I think he's got the right sort of determination for a one man show. Please leave him in his own threads.
#11
07/20/2009 (5:48 pm)
lol u got it boss
#12
07/20/2009 (10:08 pm)
sure Patrick... i'll comment on his behaviour only in his threads hehe...