Keep moving even if Win Conditions are Met

43 views
Skip to first unread message

Gregorio Puzzles

unread,
Jan 5, 2024, 3:14:18 PMJan 5
to PuzzleScript
Hi!

I just have discovered PuzzleScript and I love it!

I'm trying to write a game with sliding balls. You must try to put the green balls into a hole (target) but avoid putting the red ones. However, one all green balls have gone, it triggers the win conditions even if the red ball is about to fall into the hole.

I don't know how to write the "again" rules or the win conditions to detect this.

Here you have a Minimal Working Example. In the first level you shouldn't win: 

title Minimal Working Example
author Gregorio Morales

again_interval 0.05



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

Background .
lightgray

Wall
brown

Target
lightgray black
00000
01110
01010
01110
00000


RojoTemp
red
.....
.000.
.000.
.000.
.....


Verde
green


VerdeR
green


Rojo
red

RojoR
red

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

# = Wall
@ = Verde
X = Rojo
T = Target

Player = Verde or Rojo
objeto = Wall or Verde or Rojo

algoVerde = Verde or VerdeR
algoRojo  = Rojo  or RojoR  


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

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

Background
Target
RojoTemp
Wall, Verde, Rojo,VerdeR,RojoR

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

(start)

[right Verde] -> [right VerdeR]

[right Rojo] -> [right RojoR]

(slide)

[VerdeR] -> [right VerdeR] again

[RojoR] -> [right RojoR] again

(stop)

right [> VerdeR|objeto] -> [Verde|objeto]

right [> RojoR|objeto] -> [Rojo|objeto]



(fall into hole)

late [algoverde Target] -> [ Target]

late [algoRojo Target] -> [RojoTemp Target]

late [RojoTemp Target] -> sfx1 restart message Red can't fall

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

no algoverde

=======
LEVELS
=======

#######################
#....X..@.........T...#
#######################


#######################
#..@.X............T...#
#######################


Thank you very much,
Gregorio Morales

fox....@gmail.com

unread,
Jan 5, 2024, 6:14:42 PMJan 5
to PuzzleScript
In this case you can add the following line to winconditions:
no RojoR

The only downside is that you will need to wait for the red ball to stop before winning the level. You could do something more sophisticated and predict whether red will fall, but it will require more changes to the code.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages