The recent shift in compulsory education from ICT-focused computing curricula to informatics, digital literacy and computer science, has resulted in children being taught computing using block-based programming tools such as Scratch, with teaching that is often limited by school resources and teacher expertise. Even without these limitations, Scratch users often produce code with ‘code smells’ such as duplicate blocks and long scripts which impact how they understand and debug projects. These code smells can be removed using procedural abstraction, an important concept in computer science rarely taught to this age group. This article describes the design of a novel educational block-based programming game, Pirate Plunder, which concentrates on how procedural abstraction is introduced and reinforced. The article then reports an extended evaluation to measure the game’s efficacy with children aged 10 and 11, finding that children who played the game were then able to use procedural abstraction in Scratch. The article then uses game analytics to explore why the game was effective and gives three recommendations for educational game design based on this research: using learning trajectories and restrictive success conditions to introduce complex content, increasing learner investment through customisable avatars and suggestions for improving the evaluations of educational games.