• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 21:54
CEST 03:54
KST 10:54
  • 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
RSL Season 1 - Final Week4[ASL19] Finals Recap: Standing Tall10HomeStory Cup 27 - Info & Preview18Classic wins Code S Season 2 (2025)16Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0
Community News
Firefly given lifetime ban by ESIC following match-fixing investigation17$25,000 Streamerzone StarCraft Pro Series announced6Weekly Cups (June 30 - July 6): Classic Doubles6[BSL20] Non-Korean Championship 4x BSL + 4x China10Flash Announces Hiatus From ASL70
StarCraft 2
General
RSL Revival patreon money discussion thread The GOAT ranking of GOAT rankings We need to be discussing a new patch right now! Firefly given lifetime ban by ESIC following match-fixing investigation RSL Season 1 - Final Week
Tourneys
RSL: Revival, a new crowdfunded tournament series FEL Cracov 2025 (July 27) - $8000 live event Sparkling Tuna Cup - Weekly Open Tournament $25,000 Streamerzone StarCraft Pro Series announced WardiTV Mondays
Strategy
How did i lose this ZvP, whats the proper response Simple Questions Simple Answers
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 481 Fear and Lava Mutation # 480 Moths to the Flame Mutation # 479 Worn Out Welcome Mutation # 478 Instant Karma
Brood War
General
BW General Discussion A cwal.gg Extension - Easily keep track of anyone ASL20 Preliminary Maps BGH Auto Balance -> http://bghmmr.eu/ Script to open stream directly using middle click
Tourneys
Small VOD Thread 2.0 [Megathread] Daily Proleagues Last Minute Live-Report Thread Resource! [BSL20] Non-Korean Championship 4x BSL + 4x China
Strategy
Simple Questions, Simple Answers I am doing this better than progamers do.
Other Games
General Games
Path of Exile CCLP - Command & Conquer League Project Stormgate/Frost Giant Megathread The PlayStation 5 Nintendo Switch Thread
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 Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Accidental Video Game Porn Archive Stop Killing Games - European Citizens Initiative
Fan Clubs
SKT1 Classic Fan Club! Maru Fan Club
Media & Entertainment
Movie Discussion! [Manga] One Piece Anime Discussion Thread [\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
The Automated Ban List
Blogs
Men Take Risks, Women Win Ga…
TrAiDoS
momentary artworks from des…
tankgirl
from making sc maps to makin…
Husyelt
StarCraft improvement
iopq
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 548 users

Student Game Dev Part 19 - Water and enemies

Blogs > Soan
Post a Reply
Soan
Profile Blog Joined August 2010
New Zealand194 Posts
April 04 2014 01:43 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
Part Seventeen - Video!
Part Eighteen - Layers and Music


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 getting moving platforms to work properly, and had a new video. Last week I talked about getting some parallax scrolling working, and talking a bit about music for the game. This week I'll be talking about adding water to the game, fixing the enemy movement, and starting to add coins to the game.

Water
Added water to the editor, and got it functional in the game. Placing water areas in the editor is exactly the same as placing normal tiles, however the interaction between the player and the water tiles in the game is obviously different from the interaction with the normal tiles. Entering a water tile kills the player, as Sam is a terrible pirate who does not know how to swim. When writing this code though, rather than kill the player the instant they hit the water, I'm waiting until the player is at least partially in the water. If I didn't wait, then when the player died, it would look like they are standing on the water, like they're a Jesus pirate, which would look kind of silly.

The water doesn't look like much at the moment. It's just using a plain blue texture with a bit of transparency, without any animations. Making it animated would be pretty easy, but I'm not sure it's worth spending time on that just yet, I'll look at doing in the future. I probably will have time, with the way things have been going these last couple of weeks, but we'll see!

Enemy Movement
After I added the water, I realised that fixing the enemy movement so they didn't wander off the edges of platforms was relatively urgent. In a few places, they would wander off, then hit water and fall forever because I didn't have any checks for them hitting anything else. So now they're checking the level to see if there is a tile directly in front of them to stand on, and turning around if there isn't. This does mean that that each enemy is asking the level to check all the tiles against the position of the enemy, which is pretty inefficient, but it was the fastest way I could think of at the time to get it work.

It wasn't until a couple of days later that I realised implementing invisible trigger blocks would have made far more sense, and would allow these blocks to be used elsewhere. For instance, I could have trigger blocks to reverse an enemies direction, ones to cause an enemy to jump, or any other event that I wanted to trigger within the game. One of the tutors had even mentioned it to me some time ago as well, so I'm slightly annoyed at myself for not thinking about it before hand. If I have time, I might look at implementing invisible trigger blocks, but otherwise it's something to think about for the future, when I rebuild the entire engine to be infinitely better that it currently is.

Coins
Added pirate coins to both the editor and the game, although there is no interaction with them present in the game just yet. That is a job for next week. Didn't have any proper art for them, so I whipped up some quick programmer art, and created a sprite sheet to show the coins spinning around. It looks alright to me, at least for now.

[image loading]

I had been expecting to possibly need to put in some randomisation on which frame the animation started, but this turned out to not be necessary given the way the engine works. The animation doesn't start playing, or even processing it's frames, until the coin is visible on screen. So while every coin starts at the first frame, the time at which this starts is different for each coin, as they appear on screen at different times. So that creates a nice visual effect with all the coins on screen looking like they're rotating differently.

Screenshot
[image loading]
Current state of the game. No coins on this level yet, but you can see the water (the blue block), and the programmer art clouds in the background as a parallax effect. Still missing a few animations, but I've cleverly taken the screen shot at a point where only the existing ones are visible.

What's Next?
Next week, I'll be adding everything to do with the score. Gaining score on collecting coins/killing enemies, displaying the current score, and saving it per level as the score is done per level. Depending on how that goes, I'll also look at finally adding a sound system to the engine, so I can add some background music and sounds. If I get to that point I'll probably do another video next week as well.

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.

*
EatThePath
Profile Blog Joined September 2009
United States3943 Posts
April 04 2014 05:52 GMT
#2
With the enemies turning around at ledges, why not just have each enemy check its surroundings instead of every tile? Or am I misunderstanding you?

Lovely clouds.
Comprehensive strategic intention: DNE
Soan
Profile Blog Joined August 2010
New Zealand194 Posts
April 04 2014 20:57 GMT
#3
I could do that, but they each enemy doesn't know what tiles are around them, and as they moved I'd have to update that information, which would still require checking the level to see what tiles were around them.

The entire thing is probably horribly inefficient, but it was the fastest way for me to get it up and running, which is the most important thing in this case.
EatThePath
Profile Blog Joined September 2009
United States3943 Posts
April 05 2014 00:42 GMT
#4
On April 05 2014 05:57 Soan wrote:
I could do that, but they each enemy doesn't know what tiles are around them, and as they moved I'd have to update that information, which would still require checking the level to see what tiles were around them.

The entire thing is probably horribly inefficient, but it was the fastest way for me to get it up and running, which is the most important thing in this case.

Yeah, and it probably doesn't really matter in the end. But, if you are drawing them moving, don't you know where they are? XD I dunno how your grid / objects / level data work so maybe it's just not worth making it work with a "check nearby" scheme.
Comprehensive strategic intention: DNE
Please log in or register to reply.
Live Events Refresh
The PiG Daily
22:50
Best Games of SC
Clem vs ByuN
SHIN vs GuMiho
PiGStarcraft563
LiquipediaDiscussion
SC Evo Complete
22:00
Enki Epic Ser. Taeja vs soO EN
davetesta73
Liquipedia
OSC
20:00
Mid Season Playoffs
Spirit vs GeraldLIVE!
Solar vs ShoWTimE
SteadfastSC170
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft563
Nina 188
SteadfastSC 170
RuFF_SC2 112
StarCraft: Brood War
Aegong 85
NaDa 38
Icarus 9
Stormgate
NightEnD15
Dota 2
monkeys_forever734
NeuroSwarm106
League of Legends
JimRising 834
febbydoto12
Heroes of the Storm
Khaldor132
Other Games
summit1g9707
shahzam483
C9.Mang0213
ViBE190
Trikslyr71
Organizations
Other Games
gamesdonequick45150
BasetradeTV32
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Berry_CruncH131
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Azhi_Dahaki27
• Pr0nogo 3
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1908
Other Games
• Scarra886
Upcoming Events
RSL Revival
8h 7m
SHIN vs Clem
Cure vs TBD
FEL
10h 7m
FEL
14h 7m
Gerald vs PAPI
Spirit vs ArT
CSO Cup
14h 7m
BSL20 Non-Korean Champi…
16h 7m
Bonyth vs QiaoGege
Dewalt vs Fengzi
Hawk vs Zhanhun
Sziky vs Mihu
Mihu vs QiaoGege
Zhanhun vs Sziky
Fengzi vs Hawk
DaveTesta Events
16h 7m
Sparkling Tuna Cup
1d 8h
RSL Revival
1d 8h
Classic vs TBD
FEL
1d 13h
BSL20 Non-Korean Champi…
1d 16h
Bonyth vs Dewalt
QiaoGege vs Dewalt
Hawk vs Bonyth
Sziky vs Fengzi
Mihu vs Zhanhun
QiaoGege vs Zhanhun
Fengzi vs Mihu
[ Show More ]
Wardi Open
2 days
Replay Cast
3 days
WardiTV European League
3 days
PiGosaur Monday
3 days
uThermal 2v2 Circuit
4 days
Replay Cast
4 days
The PondCast
5 days
Replay Cast
5 days
Epic.LAN
6 days
Liquipedia Results

Completed

KCM Race Survival 2025 Season 2
HSC XXVII
NC Random Cup

Ongoing

JPL Season 2
BSL 2v2 Season 3
Acropolis #3
CSL 17: 2025 SUMMER
Copa Latinoamericana 4
Jiahua Invitational
2025 ACS Season 2: Qualifier
CSLPRO Last Chance 2025
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

Upcoming

CSL Xiamen Invitational
CSL Xiamen Invitational: ShowMatche
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
Underdog Cup #2
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.