Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (juanex, AndrewAMD), 988 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
goto skip; #368098
04/21/11 14:15
04/21/11 14:15
Joined: May 2009
Posts: 5,365
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,365
Caucasus
I'm trying to convert very old (A5) RPG tutorial into LITE-C.
I made it till own the collusion detection, but I skipped one thing.
There is something similar to this:
Code:
while(1)
{
	if(key_cuu == 1){heru.y += 8 * time; goto skip;}
	if(key_cud == 1){heru.y -= 8 * time; goto skip;}
	if(key_cur == 1){heru.x += 8 * time; goto skip;}
	if(key_cul == 1){heru.x -= 8 * time; goto skip;}
	skip:
	wait(1);
}

Ofcource label "skip" isn't found in current LITE-C, cause we should define it before using.
But how can I define it? I've never worked with "goto" thing, I'm not looking for workaround for it.
All I want is to define "skip:" label, so I could use "goto" in movement. Thank you all for advices.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: goto skip; [Re: 3run] #368100
04/21/11 14:35
04/21/11 14:35
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Code:
while(1)
{
	heru.x += (key_cur-key_cul)* 8 * time;
	heru.y += (key_cuu-key_cud)* 8 * time;
	wait(1);
}




"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: goto skip; [Re: 3run] #368101
04/21/11 14:38
04/21/11 14:38
Joined: Oct 2009
Posts: 149
Germany
M
muffel Offline
Member
muffel  Offline
Member
M

Joined: Oct 2009
Posts: 149
Germany
delete the skip part and write for the last three if's ifelse
or:
delete the "skip:" and replace "goto skip;" with continue and put the wait(1); at the head of the loop

In code
Code:
while(1)
{
	if(key_cuu == 1){heru.y += 8 * time; }
	elseif(key_cud == 1){heru.y -= 8 * time; }
	elseif(key_cur == 1){heru.x += 8 * time; }
	elseif(key_cul == 1){heru.x -= 8 * time; }
	wait(1);
}


Code:
while(1)
{
        wait(1);
	if(key_cuu == 1){heru.y += 8 * time; continue;}
	if(key_cud == 1){heru.y -= 8 * time; continue;}
	if(key_cur == 1){heru.x += 8 * time; continue;}
	if(key_cul == 1){heru.x -= 8 * time; continue;}
}



muffel

Re: goto skip; [Re: Superku] #368102
04/21/11 14:38
04/21/11 14:38
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
i'd use something similar to SuperKu approach,

though if you really need to use goto (REALLY SHOULDN'T!)
Code:
void main(){
}	
	goto skip;
		beep();
	skip:
}



Re: goto skip; [Re: MrGuest] #368131
04/21/11 18:32
04/21/11 18:32
Joined: May 2009
Posts: 5,365
Caucasus
3run Offline OP
Senior Expert
3run  Offline OP
Senior Expert

Joined: May 2009
Posts: 5,365
Caucasus
Thank you all guys, first of all I really didn't get why "goto:" was used in tutorial.
I didn't read tutorial much, I was just copying, pasting, converting to LITE-C and compiling.
Now I got it, and I see that usage of "goto" this isn't really necessary, thank you all.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung

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