Sorry for frustrating you. I have no internet on my computer. I am posting by mobile.
This forum is now archived!
- Welcome to the archive!
News:
The 3DRad community can be found at classdev.net.
- 3D Rad - Free 3D game maker - Forum >
- General Category >
- 3D Rad - User-created Sample Projects, Scripts, Tutorials >
- Script related questions
Author Topic: Script related questions (Read 8112 times)
What do I write when in if statement there are two conditions, think I have to jump and then I have to dash. After these two conditions I have to hide.
Should I put comma(,) between the two conditions and then put these two conditions on then brackets after if?
Should I put comma(,) between the two conditions and then put these two conditions on then brackets after if?
Oh, I meant the action should not be two. But. The conditions should be two.
Should it be like:-
if (condition1, condition2)
{ Action;
}
Sorry for I did not clearify that before.
Should it be like:-
if (condition1, condition2)
{ Action;
}
Sorry for I did not clearify that before.
Yep, what Mike said.
if (condition1 && condition2) Action; //And
if (condition1 || condition2) Action; //Or
Keep in mind you can use '()' to create priorities.
This...
if (condition1 || conditon2 && condtion3 || condtion4) Action;
...Is not the same as...
if ((condition1 || conditon2) && (condtion3 || condtion4)) Action;
if (condition1 && condition2) Action; //And
if (condition1 || condition2) Action; //Or
Keep in mind you can use '()' to create priorities.
This...
if (condition1 || conditon2 && condtion3 || condtion4) Action;
...Is not the same as...
if ((condition1 || conditon2) && (condtion3 || condtion4)) Action;
What a brilliance.
For car
If (jump) and (jump and dash)
Action hide;
Will that work?
I am thinking if the script can be written in loop. If so, can you tell me how?
For car
If (jump) and (jump and dash)
Action hide;
Will that work?
I am thinking if the script can be written in loop. If so, can you tell me how?
What should I write not to immediately hide when I just press dash. But after some time when I press dash it disappears. So that I can see the dash before disappearing.
If (jump) and (jump and dash) Action hide;
It isn't necessary to add jump twice. This should work:
if (jump && dash) ActionHide;
And you won't need any loops.
What should I write not to immediately hide when I just press dash. But after some time when I press dash it disappears. So that I can see the dash before disappearing.
Try something like the following:
float timer = -1;
void Main()
{
if (jump && dash) //If jump and dash...
{
if (timer = -1) timer = 0; //Set Timer from inactive (-1) to active (0), but just once, otherwise the timer won't work.
}
if (timer > -1) timer += 0.016667; //If timer is active, start counting by approximately 1/60 of a second.
if (timer > x) //When you've waited long enough...
{
iObjectHide(OBJ_x); //Do your stuff.
timer = -1; //Set timer back to inactive.
}
That should do it.
I am worried how I will make scripts on later parts of my game even I can not comprehend the script that I have written in past. If I add jump twice, will the program take the result once to avoid what is written on process or examine first part to execute and then second part?
I have clue what your actual question is.
A little tip, not at all meant offensive in any way, don't try to sound smart. It's unnecessary and just makes you less comprehensible.
A little tip, not at all meant offensive in any way, don't try to sound smart. It's unnecessary and just makes you less comprehensible.
Ohh,sorry. Many things to tell and I cant see small things well. On a post I accidentally read is instead of isn't. So I got whole thing wrong
Quote
don't try to sound smart. It's unnecessary and just makes you less comprehensible.that's some good advice... probably why nothing i say makes any sense ay all...
--Mike