Scrolling Game Development Kit Forum
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Help
Search
Login
Register
Scrolling Game Development Kit Forum
»
SGDK Version 2
»
Help, Errors, FAQ
»
Nesting of If rules
« previous
next »
Print
Pages: [
1
]
Author
Topic: Nesting of If rules (Read 5728 times)
dutch_619
Regular
Posts: 90
Nesting of If rules
«
on:
2008-11-30, 08:43:32 PM »
For some reason I can't get separate If commands. Each new If ends up nested within the parent (first) If rule. I assumed initially it was due to the lack of an EndIf, but that doesn't seem to be the case. I did a search of the forum for an answer and this seems to be a problem with the early releases of SGDK2. However the version on my PC is the latest release.
Any ideas?
Logged
SmartBoy16
Contributor
Fanatic
Posts: 587
Looking for inspiration.....
Re: Nesting of If rules
«
Reply #1 on:
2008-11-30, 08:49:07 PM »
if this was manual c# you start the if, while, for, ect. functions with a "{" and end with a "}".
Logged
Looking to the skies.....
dutch_619
Regular
Posts: 90
Re: Nesting of If rules
«
Reply #2 on:
2008-11-30, 08:56:23 PM »
I was hoping to avoid going that route and use the built in rules editor. It is mighty handy, and rather nifty as well.
Logged
bluemonkmn
SGDK Author
Administrator
Fanatic
Posts: 2761
Re: Nesting of If rules
«
Reply #3 on:
2008-12-01, 07:38:38 AM »
the last rule within an If block needs to have "End If" checked. If you are nested multiple levels, you may need to add additional "EndIf" rules to close all the nesting levels and get back to the top. If you can't figure it out, describe in detail what you are trying (what you are clicking in what order) and I can probably tell you what to correct.
Logged
Ben Marty
Scrolling Game Development Kit 2
durnurd
Lead Lemming
Expert
Fanatic
Posts: 1234
Games completed so far: 0
Re: Nesting of If rules
«
Reply #4 on:
2008-12-01, 03:31:53 PM »
Although this does point out that perhaps there should be a simpler way to do end-ifs.
The first thing that comes to mind is to have buttons on the top of the tree view which control the level of indentation of the selected nodes (within the allowable limit based on where the ifs/whiles are)
Logged
Ed
wa
rd
Da
ss
me
ss
er
dutch_619
Regular
Posts: 90
Re: Nesting of If rules
«
Reply #5 on:
2008-12-01, 08:41:16 PM »
Now that would be a nice feature.
Hmm, as it sits, I can close out the If nested set, but it dumps the else-ifs into their own grouping. I had hoped to flow like so
If-> else-if -> else-if -> else
If-> else-if->else
etc.etc.etc.
Logged
bluemonkmn
SGDK Author
Administrator
Fanatic
Posts: 2761
Re: Nesting of If rules
«
Reply #6 on:
2008-12-01, 09:41:43 PM »
If you want to do that, then I think you need:
If (Level 1)
...
else if (level 2)
...
else if (level 3)
...
else ... (with implicit end if for level 3)
explicit End If (level 2)
explicit End If (level 1)
If (Level 1)
...
else if (level 2)
...
else ... (with implicit end if for level 2)
explicit end (level 1)
Logged
Ben Marty
Scrolling Game Development Kit 2
dutch_619
Regular
Posts: 90
Re: Nesting of If rules
«
Reply #7 on:
2008-12-01, 09:54:48 PM »
That seems to work! Thank you much! I imported a few sprite templates and used them for reference.
Now to get the video to play smoothly...
Logged
Print
Pages: [
1
]
« previous
next »
Scrolling Game Development Kit Forum
»
SGDK Version 2
»
Help, Errors, FAQ
»
Nesting of If rules