Skip to content

Commit dfb07cb

Browse files
committed
Port Pachinko to current plugin version
This was mainly a direct reimplementation of each BlockCode program, with a few tweaks. I had to make the Ball group global so that it shows up in the “[something] is in group [group ▼]” dropdown. I also added an extra Reset method on the "Bump!" label to hide it when the game resets, calling it directly with "call [method] on [node]". The code that plays one of 5 sounds at random when the ball hits a pin previously relied on being able to pass an int as the "sound name" parameter, which would for some reason I didn't bother digging into would previously cause a str() conversion to be inserted, but now does not. ```gdscript func _on_body_entered(body: Node2D): if body.is_in_group('Ball'): PinSound = randi_range(1, 5) var __sound_node_1 = get_node(str(PinSound)) # ... ``` So instead I use a chain of conditionals that compiles to: ```gdscript func _on_body_entered(something: Node2D): if ((something).is_in_group('Ball')): PinSound = randi_range(1, 5) if PinSound == 1: var __sound_node_1 = get_node('1') # ... elif PinSound == 2: # ... ``` This is a bit wordier than what was there before but it works. It would be nice to have a way to define a local variable rather than a property of the node, but it's not the end of the world. https://phabricator.endlessm.com/T35697 JJ: M game-04/main.tscn JJ: M game-04/pin.tscn JJ: M project.godot
1 parent 9458b7c commit dfb07cb

File tree

3 files changed

+715
-1041
lines changed

3 files changed

+715
-1041
lines changed

0 commit comments

Comments
 (0)