• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 02:56
CEST 08:56
KST 15:56
  • 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
[ASL19] Finals Recap: Standing Tall9HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy6
Community News
Flash Announces Hiatus From ASL61Weekly Cups (June 23-29): Reynor in world title form?13FEL Cracov 2025 (July 27) - $8000 live event19Esports World Cup 2025 - Final Player Roster16Weekly Cups (June 16-22): Clem strikes back1
StarCraft 2
General
Statistics for vetoed/disliked maps Program: SC2 / XSplit / OBS Scene Switcher The SCII GOAT: A statistical Evaluation Weekly Cups (June 23-29): Reynor in world title form? PiG Sty Festival #5: Playoffs Preview + Groups Recap
Tourneys
FEL Cracov 2025 (July 27) - $8000 live event RSL: Revival, a new crowdfunded tournament series Korean Starcraft League Week 77 Master Swan Open (Global Bronze-Master 2) [GSL 2025] Code S: Season 2 - Semi Finals & Finals
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma Mutation # 477 Slow and Steady
Brood War
General
Flash Announces Hiatus From ASL Player “Jedi” cheat on CSL ASL20 Preliminary Maps SC uni coach streams logging into betting site BGH Mineral Boosts Tutorial Video
Tourneys
[BSL20] Grand Finals - Sunday 20:00 CET [Megathread] Daily Proleagues Small VOD Thread 2.0 [BSL20] GosuLeague RO16 - Tue & Wed 20:00+CET
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Path of Exile Stormgate/Frost Giant Megathread Nintendo Switch Thread What do you want from future RTS games? Beyond All Reason
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Trading/Investing Thread Things Aren’t Peaceful in Palestine The Games Industry And ATVI
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2025 Football Thread Formula 1 Discussion NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Blogs
Culture Clash in Video Games…
TrAiDoS
from making sc maps to makin…
Husyelt
Blog #2
tankgirl
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 543 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
Next event in 3h 4m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Leta 592
Larva 268
Barracks 52
Dota 2
XaKoH 627
League of Legends
JimRising 745
Counter-Strike
Stewie2K1027
Heroes of the Storm
Khaldor219
Other Games
WinterStarcraft650
SortOf103
kaitlyn77
ProTech53
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 17 non-featured ]
StarCraft 2
• Berry_CruncH367
• Hupsaiya 91
• Sammyuel 42
• Kozan
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• intothetv
• Migwel
• IndyKCrew
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• lizZardDota2175
League of Legends
• Lourlo1524
• masondota2719
• Stunt489
Upcoming Events
RSL Revival
3h 4m
Clem vs Classic
SHIN vs Cure
FEL
5h 4m
WardiTV European League
5h 4m
BSL: ProLeague
11h 4m
Dewalt vs Bonyth
Replay Cast
1d 17h
Sparkling Tuna Cup
2 days
WardiTV European League
2 days
The PondCast
3 days
Replay Cast
3 days
RSL Revival
4 days
[ Show More ]
Replay Cast
4 days
RSL Revival
5 days
FEL
5 days
RSL Revival
6 days
FEL
6 days
FEL
6 days
Liquipedia Results

Completed

BSL 2v2 Season 3
HSC XXVII
Heroes 10 EU

Ongoing

JPL Season 2
BSL Season 20
Acropolis #3
KCM Race Survival 2025 Season 2
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Championship of Russia 2025
RSL Revival: Season 1
Murky Cup #2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025

Upcoming

2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
2025 ACS Season 2
CSLPRO Chat StarLAN 3
K-Championship
uThermal 2v2 Main Event
SEL Season 2 Championship
FEL Cracov 2025
Esports World Cup 2025
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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 © 2025 TLnet. All Rights Reserved.