Edited by Joe123, 29 January 2008 - 11:22 AM.
Sail Boat Script
#16
Posted 29 January 2008 - 11:22 AM
#17
Posted 29 January 2008 - 12:04 PM
#18
Posted 29 January 2008 - 12:32 PM
Why not?
#19
Posted 29 January 2008 - 02:32 PM
Back on topic:
I don't get it. Why won't the boat move!?
#20
Posted 29 January 2008 - 02:41 PM
ffc script boat{
void run(){
ffc link2 = Screen->LoadFFC(2);
ffc water = Screen->LoadFFC(3);
while(true){
//Link->Action = LA_FROZEN;
if(Link->InputUp){
this->Vy = 1;
link2->Vy = 1;
water->Vy = 1;
}
if(Link->InputDown){
this->Vy = -1;
link2->Vy = -1;
water->Vy = -1;
}
if(link2->Y > 152){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
if(link2->Y < 16){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
Waitframe();
}
}
}
Try that.
I haven't but I did change some rather unusual parts of the script.
Set on FFC 1:
The combo you want the boat to have
This script
#21
Posted 29 January 2008 - 03:04 PM
Updated Script:
void run(){
ffc link2 = Screen->LoadFFC(2);
ffc water = Screen->LoadFFC(3);
while(true){
//Link->Action = LA_FROZEN;
if(link2->Y > 136){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
if(link2->Y < 32){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
if(Link->InputUp){
this->Vy = -1;
link2->Vy = -1;
water->Vy = -1;
}
if(Link->InputDown){
this->Vy = 1;
link2->Vy = 1;
water->Vy = 1;
}
if(Link->InputLeft || Link->InputRight){
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
Waitframe();
}
}
}
Now the boat will move up and down. Press left or right to make it stop moving.
There was a bug that wouldn't let you move the boat after it touched the top or bottom of the screen. But I fixed it.
Just a simple mater of moving
if(link2->Y < 32){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
higher.
Edit: Now to make it jump. Any ideas?
Edited by Mega Link, 29 January 2008 - 03:32 PM.
#22
Posted 29 January 2008 - 03:44 PM
void run(){
ffc link2 = Screen->LoadFFC(2);
ffc water = Screen->LoadFFC(3);
bool upcheck;
while(true){
//Link->Action = LA_FROZEN;
upcheck = false;
if(Link->InputUp){
this->Vy = -1;
link2->Vy = -1;
water->Vy = -1;
upcheck = true;
}else{
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
if(Link->InputDown && !upcheck){
this->Vy = 1;
link2->Vy = 1;
water->Vy = 1;
}else{
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
if(link2->Y > 136 && this->Vy > 0){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
if(link2->Y < 32 && this->Vy < 0){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
Waitframe();
}
}
}
Now it stops moving when you stop pressing the button.
I thought you wanted it to continue.
It'll also not be able to leave the screen, but it won't stop moving ever once it hits the edges.
And making it jump probably wouldn't be impossible.
Hrm.
I think you need to sort out barrel collision first though.
Edited by Joe123, 29 January 2008 - 03:45 PM.
#23
Posted 29 January 2008 - 04:21 PM
#24
Posted 29 January 2008 - 04:26 PM
void run(){
ffc link2 = Screen->LoadFFC(2);
ffc water = Screen->LoadFFC(3);
bool upcheck;
while(true){
//Link->Action = LA_FROZEN;
upcheck = false;
if(Link->InputUp){
this->Vy = -1;
link2->Vy = -1;
water->Vy = -1;
upcheck = true;
}else{
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
if(Link->InputDown){
this->Vy = 1;
link2->Vy = 1;
water->Vy = 1;
}else{
if(!upcheck){
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
}
if(link2->Y > 136 && this->Vy > 0){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
if(link2->Y < 32 && this->Vy < 0){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
Waitframe();
}
}
}
Sorry, I noticed that, then made a half-assed attempt to fix it in an edit, but I obviously didn't think it through properly.
#25
Posted 29 January 2008 - 05:24 PM
I decided to do the obstacles in a different, fairly easier way.
Woah! I messed up!
//D1 = combo # for Zora diving
//D2 = combo # for Zora hit
ffc script boat{
void run(int rise, int dive, int hit){
ffc link2 = Screen->LoadFFC(2);
ffc water = Screen->LoadFFC(3);
bool upcheck;
int zorapos;
ffc zora1 = Screen->LoadFFC(4);
ffc zora2 = Screen->LoadFFC(5);
ffc zora3 = Screen->LoadFFC(6);
bool zora;
while(true){
//Link->Action = LA_FROZEN;
upcheck = false;
if(Link->InputUp){
this->Vy = -1;
link2->Vy = -1;
water->Vy = -1;
upcheck = true;
}else{
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
if(Link->InputDown){
this->Vy = 1;
link2->Vy = 1;
water->Vy = 1;
}else{
if(!upcheck){
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
}
if(link2->Y > 136 && this->Vy > 0){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
if(link2->Y < 32 && this->Vy < 0){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
Waitframe();
int zorapos = Rand(3);
if(zorapos == 1) {
zora1->Data = rise;
zora = true;
Waitframes(200);
zora1->Data = dive;
zora = false;
}
if(zorapos == 2) {
zora2->Data = rise;
zora = true;
Waitframes(200);
zora2->Data = dive;
zora = false;
}
if(zorapos == 3) {
zora3->Data = rise;
zora = true;
Waitframes(200);
zora3->Data = dive;
zora = false;
}
}
}
}
#26
Posted 29 January 2008 - 05:41 PM
*sigh*
void run(){
ffc link2 = Screen->LoadFFC(2);
ffc water = Screen->LoadFFC(3);
bool upcheck;
while(true){
//Link->Action = LA_FROZEN;
upcheck = false;
if(Link->InputUp){
this->Vy = -1;
link2->Vy = -1;
water->Vy = -1;
upcheck = true;
}else{
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
if(Link->InputDown){
this->Vy = 1;
link2->Vy = 1;
water->Vy = 1;
}else{
if(!upcheck){
this->Vy = 0;
link2->Vy = 0;
water->Vy = 0;
}
}
if(link2->Y > 136 && this->Vy > 0){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
if(link2->Y < 32 && this->Vy < 0){this->Vy = 0; link2->Vy = 0; water->Vy = 0;}
Waitframe();
}
}
}
ffc script barrel{
void run(){
bool go; int ran;
while(true){
ran = Rand(104) + 32;
this->Y = ran;
this->X = 256;
this->Vx = -1;
go = true;
while(go){
if(this->X < 8) go = false;
Waitframe();
}
Waitframe();
}
}
}
Two scripts.
First one is the same as before, second one takes the ffc it's attacked to, sets it at a random Y position and at the far right of the screen, then makes it more to the left at 1 pixel per frame, then puts it back at the right when it gets to the left of the screen, and it goes round again.
If you want two barrels, just make two ffcs with the same script.
Just give it the correct graphic, and leave it in the top left of the screen, and check the 'Run Script on Screen Init.' FFC flag.
Try that out, and tell me if it works.
Is like where the boat is, or just in the corner of the screen at the moment?
Cause I'll need to know that to add the damage detection function.
At the moment, they won't do any damage, I just need to know if they work.
#27
Posted 29 January 2008 - 05:52 PM
And when there are multiple barrels, they move next to each other. Sometimes on each other.
Edited by Mega Link, 29 January 2008 - 05:54 PM.
#28
Posted 29 January 2008 - 06:03 PM
ffc script barrel{
void run(){
bool go; int ran;
while(true){
ran = Rand(180); //space out the barrels
Waitframes(ran);
ran = Rand(104) + 32; //put the barrel at a random Y coordinate
this->Y = ran;
this->X = 256;
ran = (Rand(5)/10) + 0.25; // random speeds
this->Vx = ran;
go = true;
while(go){
if(this->X < 8) go = false;
Waitframe();
}
}
}
}
It's more random now.
Where are you putting Link on the screen?
Cause I need to know how to do the damage function
#29
Posted 29 January 2008 - 07:29 PM
Link is at (16,0).
#30
Posted 30 January 2008 - 03:18 AM
void run(){
bool go; int ran; int orig = this->Data;
this->Data = blanknonzerocombo;
ran = Rand(120); //space out the barrels
Waitframes(ran);
this->Data = orig;
while(true){
ran = Rand(104) + 32; //put the barrel at a random Y coordinate
this->Y = ran;
this->X = 256;
ran = (Rand(5)/10) + 0.25; // random speeds
this->Vx = -ran;
go = true;
while(go){
if(this->X < -16) go = false;
Waitframe();
}
Waitframes(10);
}
}
}
That's the one.
The barrels might go on top of each other, if they do, tough luck.
EDIT: Oh, I haven't added collision detection yet, but I need to go to school now, I'll do it when I get home.
Edited by Joe123, 30 January 2008 - 03:19 AM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users