• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 11:51
CEST 17:51
KST 00:51
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro8 Preview Pt2: Progenitors0Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun13[ASL21] Ro8 Preview Pt1: Inheritors16[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists22
Community News
RSL Revival: Season 5 - Qualifiers and Main Event8Code S Season 1 (2026) - RO12 Results02026 GSL Season 1 Qualifiers25Maestros of the Game 2 announced92026 GSL Tour plans announced15
StarCraft 2
General
Code S Season 1 - RO12 Group A: Rogue, Percival, Solar, Zoun Code S Season 1 (2026) - RO12 Results Team Liquid Map Contest #22 - The Finalists Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool MaNa leaves Team Liquid
Tourneys
GSL Code S Season 1 (2026) RSL Revival: Season 5 - Qualifiers and Main Event SC2 INu's Battles#15 <BO.9 2Matches> WardiTV Spring Cup SEL Masters #6 - Solar vs Classic (SC: Evo)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 523 Firewall Mutation # 522 Flip My Base Mutation # 521 Memorable Boss
Brood War
General
BW General Discussion Why there arent any 256x256 pro maps? [ASL21] Ro8 Preview Pt2: Progenitors BGH Auto Balance -> http://bghmmr.eu/ ASL21 General Discussion
Tourneys
[Megathread] Daily Proleagues [ASL21] Ro8 Day 2 Escore Tournament StarCraft Season 2 [BSL22] RO16 Group Stage - 02 - 10 May
Strategy
Fighting Spirit mining rates Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread Dawn of War IV Nintendo Switch Thread Daigo vs Menard Best of 10 Diablo IV
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Russo-Ukrainian War Thread 3D technology/software discussion Canadian Politics Mega-thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece Anime Discussion Thread [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread McBoner: A hockey love story Formula 1 Discussion
World Cup 2022
Tech Support
streaming software Strange computer issues (software) [G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Movie Stars In Video Games: …
TrAiDoS
ramps on octagon
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1908 users

Student Game Dev Part 17 - Video!

Blogs > Soan
Post a Reply
Soan
Profile Blog Joined August 2010
New Zealand194 Posts
March 21 2014 00:18 GMT
#1
+ Show Spoiler [Previous parts] +
Part One - It begins
Part Two - Technical Foundation
Part Three - Game Design
Part Four - Input and Physics
Part Five - More Physics Things
Part Six - Even More Physics
Part Seven - User Interface
Part Eight - UI and the Editor
Part Nine - Editor Progress
Part Ten - Progress, and videos
Part Eleven - Fixing the Physics
Part Twelve - Unproductive
Part Thirteen - Context menu + enemies
Part Fourteen - Enemies and Problems
Part Fifteen - Play testing
Part Sixteen - Editor and Art


This Week
Hello again TeamLiquid! Welcome back to my blog about the development of The Adventures of Sam the Pirate, the 2D platformer I'm creating as the final game project for my Bachelor of Software Engineering degree. Last week I talked about fixing a couple of smaller issues, working on the editor a bit more, and had some early art of the main character. This week I'll be talking about getting moving platforms to work properly, and have a new video. This video also includes a little bit of actual art!

Moving Platforms
The moving platforms in Sam the Pirate have a very simple design. They move in one direction until they hit a stationary tile, then they turn around and go in the other direction until they hit something else, etc. I had previously implemented this behaviour into the game, although that was before I started work on the editor, so the positioning and size of the platform had been handwritten into the level file, now I was looking to add them to levels through the editor.

This turned out to not be too difficult. Positioning the sprites that make up the moving platform was easy, as it was pretty much the same as what I had already done with positioning regular tiles. Correctly calculating the size of the physics object that would be loaded into the game was not particularly difficult either. Making sure that the position of this physics object matched up with turned out to be a bit trickier, mostly because I forgot parentheses.

As the moving platforms are made up of a set of regular tile sprites, each with their own position, the correct position of the physics object needed to be in the centre. So I had to find the position on the left edge, the position on the right edge, and find the middle. Initially I did it like this:
position = right - left * 0.5 + left

Can you see the problem? Lets enter 100 for right, and 50 for left. The expected answer would be 75, yet you would get 125, because I totally forgot about the order of operations, PEDMAS, or BEDMAS, or however else you may have been taught. Either way, I forgot that any multiplication/division would be done before addition/subtraction, and so the position of the physics object was not matching the location of the sprite, which was were I wanted it to be.

To get the correct result, it needed to look like this:
position = (right - left) * 0.5 + left

I had a bit of a laugh at myself afterwards for forgetting something that should be so simple.

What that fixed, moving platforms placed into the editor loaded correctly, and started going back and forth when I played the game. The player was able to jump on and off the moving platform, however they couldn't run on them. This puzzled me for a while, as all the code for ensuring that the player was moving in tandem with the platform appeared to be working correctly, without preventing the player from moving left or right. Their position even seemed to lag behind the platform slightly, as eventually they would fall off completely.

Finally, I noticed that the game was attempting to make sure the player was moving in tandem with the platform twice, at two different points each frame! The second instance was late enough in the frame to override any player movement, making it look like they couldn't move at all. That piece of code came from when I had first implemented the moving platforms, so once I took that out everything worked just fine, as you can see in the below video!

Video
Can you spot the moon walking zombie pirate?


What's next?
Parallax scrolling is the next big item to implement. Still not entirely sure how I'm going to implement this, or what I'm going to put in there, but I've got some time over the weekend to think about it before I get stuck into it next week.

Keep up to date!
Be sure to follow me on Twitter, and like the Facebook page to stay up to date on future content and blog posts when they happen. If you have any questions don't hesitate to ask, either through Twitter or Facebook! You can also check out the blog, previous posts, screenshots and videos over at my site.

mahrgell
Profile Blog Joined December 2009
Germany3943 Posts
March 21 2014 10:57 GMT
#2
So why do the zombies fall through the moving platforms? Are your platforms racist against zombies and won't carry them?
Soan
Profile Blog Joined August 2010
New Zealand194 Posts
March 21 2014 20:43 GMT
#3
haha, no! I just haven't finished coding them yet. They're not meant to fall off platforms, I just haven't got around to implementing that.
Please log in or register to reply.
Live Events Refresh
uThermal 2v2 Circuit
14:00
Season 2 - May 2026
RotterdaM701
uThermal499
mouzHeroMarine362
IndyStarCraft 222
SteadfastSC215
elazer58
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 701
uThermal 499
mouzHeroMarine 362
IndyStarCraft 222
SteadfastSC 215
Railgan 108
BRAT_OK 86
elazer 58
MindelVK 14
StarCraft: Brood War
Britney 56129
EffOrt 2351
Horang2 1230
Shuttle 1028
ggaemo 563
Hyuk 322
firebathero 276
Soma 265
Rush 233
Leta 183
[ Show more ]
PianO 113
actioN 82
Sharp 81
Dewaltoss 81
Barracks 81
Pusan 57
ToSsGirL 52
Hm[arnc] 49
Sacsri 26
zelot 21
Rock 18
JulyZerg 13
Terrorterran 13
Shine 12
GoRush 9
Dota 2
Gorgc4468
qojqva2231
monkeys_forever203
Fuzer 201
Heroes of the Storm
Khaldor384
Other Games
singsing2253
B2W.Neo1405
Liquid`RaSZi1172
Beastyqt969
KnowMe224
Organizations
Other Games
BasetradeTV586
Dota 2
PGL Dota 2 - Main Stream64
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 14 non-featured ]
StarCraft 2
• Adnapsc2 8
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV547
League of Legends
• Jankos2189
Other Games
• Shiphtur247
Upcoming Events
BSL
3h 10m
IPSL
3h 10m
eOnzErG vs TBD
G5 vs Nesh
Patches Events
8h 10m
Replay Cast
17h 10m
Wardi Open
18h 10m
Afreeca Starleague
18h 10m
Jaedong vs Light
Monday Night Weeklies
1d
Replay Cast
1d 8h
Sparkling Tuna Cup
1d 18h
Afreeca Starleague
1d 18h
Snow vs Flash
[ Show More ]
WardiTV Invitational
1d 19h
GSL
2 days
Classic vs Cure
Maru vs Rogue
GSL
3 days
SHIN vs Zoun
ByuN vs herO
OSC
3 days
OSC
3 days
Replay Cast
4 days
Escore
4 days
The PondCast
4 days
WardiTV Invitational
4 days
Replay Cast
5 days
CranKy Ducklings
5 days
RSL Revival
5 days
SHIN vs Bunny
ByuN vs Shameless
WardiTV Invitational
5 days
BSL
6 days
Replay Cast
6 days
Sparkling Tuna Cup
6 days
RSL Revival
6 days
Cure vs Zoun
Clem vs Lambo
WardiTV Invitational
6 days
Liquipedia Results

Completed

Proleague 2026-05-02
WardiTV TLMC #16
Nations Cup 2026

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
KK 2v2 League Season 1
Acropolis #4
SCTL 2026 Spring
RSL Revival: Season 5
2026 GSL S1
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026

Upcoming

Escore Tournament S2: W6
BSL 22 Non-Korean Championship
Escore Tournament S2: W7
Escore Tournament S2: W8
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.