issue with rules symmetry

ยอดดู 108 ครั้ง
ข้ามไปที่ข้อความที่ยังไม่อ่านรายการแรก

anna anthropy

ยังไม่อ่าน,
16 เม.ย. 2559 00:23:3816/4/59
ถึง PuzzleScript
so here's the deal: i'm tinkering with a real-time game right now, and i'm trying to implement a patrolling enemy. it moves forward until it hits something, turns right, moves forward, turns right, etc. i have four different objects, each with a different facing. here's the code as i have now:

left [ GuardLeft ] -> [ > GuardLeft ]
[ > GuardLeft | Obstacle ] -> [ GuardUp | Obstacle ]
down
[ GuardDown ] -> [ > GuardDown ]
[ > GuardDown | Obstacle ] -> [ GuardLeft | Obstacle ]
right
[ GuardRight ] -> [ > GuardRight ]
[ > GuardRight | Obstacle ] -> [ GuardDown | Obstacle ]
up
[ Guardup ] -> [ > Guardup ]
[ > Guardup | Obstacle ] -> [ GuardRight | Obstacle ]

the rules are listed in counter-clockwise order so that they won't turn and then move immediately. FOR EXAMPLE, if i turned the guard to the right and then made all right-facing guards move, it would turn and move in the same moment, because the rules execute in order.

doing it this way, though, that's exactly what happens when a guard turns from left-facing to up-facing - because the "turn to face up" rule happens before the "move up" rule. so the result it that those turns happen at a different speed than the others, which is exactly not what i want.

is there some syntax or way to order the code that would help here that i just haven't found? it seems like there should be an easy way to implement this.

Alan Hazelden

ยังไม่อ่าน,
16 เม.ย. 2559 01:37:2816/4/59
ถึง anna anthropy, PuzzleScript
Can you post a playable example? It's easier to make suggestions if I can try them in code and confirm that they work.

I think reordering those rules like so should work:

left [ GuardLeft ] -> [ > GuardLeft ]
down [ GuardDown ] -> [ > GuardDown ]
right [ GuardRight ] -> [ > GuardRight ]
up [ Guardup ] -> [ > Guardup ]

[ > GuardLeft | Obstacle ] -> [ GuardUp | Obstacle ]
[ > GuardDown | Obstacle ] -> [ GuardLeft | Obstacle ]
[ > GuardRight | Obstacle ] -> [ GuardDown | Obstacle ]
[ > Guardup | Obstacle ] -> [ GuardRight | Obstacle ]

--
You received this message because you are subscribed to the Google Groups "PuzzleScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puzzlescript...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

anna anthropy

ยังไม่อ่าน,
16 เม.ย. 2559 11:40:5816/4/59
ถึง PuzzleScript, collec...@gmail.com

ok that works perfectly, thank you! i should have thought of that.

anna anthropy

ยังไม่อ่าน,
16 เม.ย. 2559 15:28:2516/4/59
ถึง PuzzleScript

also is it just me or does throttle_movement not work right? or am i missing something?

link to a VERY INCOMPLETE semi-playable thing:

http://www.puzzlescript.net/editor.html?hack=14ff0cbaec0bae51f3a8fa831ee07033

0x77

ยังไม่อ่าน,
18 เม.ย. 2559 18:15:5618/4/59
ถึง PuzzleScript
This looks amazing! Also, since you want a realtime game, you should use a fix to stop the game from speeding up when the player moves:
Look for the "( Realtime fix )" and "( Fixed realtime )" parts.

anna anthropy

ยังไม่อ่าน,
18 เม.ย. 2559 19:29:2118/4/59
ถึง PuzzleScript

so okay, my understanding of realtime mode then is:

a turn happens when the player moves (as normal)
a turn happens when the player hasn't moved for the interval specified in the prelude

is that is? that seems like...not what i would expect? like wouldn't you in most cases want things to be moving synchronously? is that fix the most elegant way of accomplishing that?

Stephen Lavelle

ยังไม่อ่าน,
18 เม.ย. 2559 20:49:2618/4/59
ถึง anna anthropy, PuzzleScript
Hi Anna!

>a turn happens when the player moves (as normal)
>a turn happens when the player hasn't moved for the interval specified in the prelude

realtime causes a turn to happen at specific intervals
turns still happen when the player presses a button

You can do pattern matches on player to check which one it is (see the documentation

If you want to limit the player's movement speed relative to other objects (so you can't just smash right over and over to move right very quickly, there's the throttle_movement flag, also described above).



--

anna anthropy

ยังไม่อ่าน,
18 เม.ย. 2559 20:59:0718/4/59
ถึง PuzzleScript, collec...@gmail.com

i tried throttle_movement (i set it to the same speed as the realtime interval) and it didn't seem to work? maybe i forgot to rebuilt or something embarrassing, i'll try it again.

anna anthropy

ยังไม่อ่าน,
18 เม.ย. 2559 21:04:0118/4/59
ถึง PuzzleScript, collec...@gmail.com

oh i think adding "[stationary player]" checks fixed it actually
ข้อความถูกลบแล้ว

Connorses

ยังไม่อ่าน,
22 เม.ย. 2559 00:54:3822/4/59
ถึง PuzzleScript
http://www.puzzlescript.net/play.html?p=292ef50a34552ba7cd7c3ca5fed87596
Here's a demo that actually works this time where you are forced to move with the realtime_interval.
ตอบทุกคน
ตอบกลับผู้สร้าง
ส่งต่อ
ข้อความใหม่ 0 รายการ