Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow link destination to be defined in rule instead of LEVELS section #81

Open
3 tasks done
Draknek opened this issue Aug 20, 2024 · 2 comments
Open
3 tasks done
Labels
enhancement Improvement to existing capability

Comments

@Draknek
Copy link
Contributor

Draknek commented Aug 20, 2024

  • I have searched the tracker for similar issues (including closed ones)
  • I have provided a detailed example for how this feature should work
  • I have provided a use case for this feature, e.g. short description/share link of a game you're making and how you'd use the feature in that game, other things you've tried, edge cases, etc. (if applicable)

I'm suggesting an optional argument to the link rules command

late [ Player links ] -> link
is the current implementation, and triggers the link, sending you to the level defined in the LEVELS section

late [ Player links ] -> link levelname
would trigger the link, sending you to the level called levelname even if the current level doesn't have any links defined in the LEVELS section

Use case: I made a game with PuzzleScript Next with lots of levels, many of which are quite hard. The ideal structure for this game would be a hub world which lets you play them in any order, but doing this in the LEVELS section would mean having 20 unique objects, which feels a bit unwieldy. Doing it in a rule would potentially be a bit simpler, i.e. I could put the level entrances in a line and do something like this:

right [ Level_A Player | Level_A | Level_A ] -> link A1
right [ Level_A | Level_A Player | Level_A ] -> link A2
right [ Level_A | Level_A | Level_A Player ] -> link A3

right [ Level_B Player | Level_B | Level_B | Level_B ] -> link B1
right [ Level_B | Level_B Player | Level_B | Level_B ] -> link B2
right [ Level_B | Level_B | Level_B Player | Level_B ] -> link B3
right [ Level_B | Level_B | Level_B | Level_B Player ] -> link B4
@Draknek Draknek added the enhancement Improvement to existing capability label Aug 20, 2024
@david-pfx
Copy link
Owner

Nice idea. I actually started out going in this direction, but switched tracks to avoid having a rule for each possible level. Having both looks (a) useful and (b) easy.😁

@rolopogo
Copy link

rolopogo commented Oct 9, 2024

Would goto not work for this situation?

author rolopogo
homepage www.polyomino.com

// 

smoothscreen 5x5
animate_interval 0.25

========
OBJECTS
========

Background 
black

Player; #00f8
Crate; orange
level_a;red

=======
LEGEND
=======

. = Background
A = level_a
P = Player
* = Crate

=======
SOUNDS
=======


================
COLLISIONLAYERS
================

Background
level_a
Player
Crate

======
RULES
======

right [ Level_A Player | Level_A | Level_A ] -> goto A1
right [ Level_A | Level_A Player | Level_A ] -> goto A2
right [ Level_A | Level_A | Level_A Player ] -> goto A3

==============
WINCONDITIONS
==============


=======
LEVELS
=======
section hub
.AAA.
.....
..p..
.....
.....


section A1
.....
.AAA.
..p..
.....
.....

section A2
.....
.....
..p..
.AAA.
.....

section A3
.....
.....
..p..
.....
.AAA.```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing capability
Projects
None yet
Development

No branches or pull requests

3 participants