• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 14:54
CEST 20:54
KST 03: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
Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho0TL Team Map Contest #5: Presented by Monster Energy4Code S RO8 Preview: herO, Zoun, Bunny, Classic7Code S RO8 Preview: Rogue, GuMiho, Solar, Maru3BGE Stara Zagora 2025: Info & Preview27
Community News
Classic & herO RO8 Interviews: "I think it’s time to teach [Rogue] a lesson."2Rogue & GuMiho RO8 interviews: "Lifting that trophy would be a testament to all I’ve had to overcome over the years and how far I’ve come on this journey.3Code S RO8 Results + RO4 Bracket (2025 Season 2)12BGE Stara Zagora 2025 - Replay Pack2Weekly Cups (June 2-8): herO doubles down1
StarCraft 2
General
Classic & herO RO8 Interviews: "I think it’s time to teach [Rogue] a lesson." Code S RO8 Results + RO4 Bracket (2025 Season 2) Code S RO4 & Finals Preview: herO, Rogue, Classic, GuMiho Rogue & GuMiho RO8 interviews: "Lifting that trophy would be a testament to all I’ve had to overcome over the years and how far I’ve come on this journey. I have an extra ticket to the GSL Ro4/finals
Tourneys
[GSL 2025] Code S: Season 2 - Semi Finals & Finals $3,500 WardiTV European League 2025 Sea Duckling Open (Global, Bronze-Diamond) SOOPer7s Showmatches 2025 RSL: Revival, a new crowdfunded tournament series
Strategy
[G] Darkgrid Layout Simple Questions Simple Answers [G] PvT Cheese: 13 Gate Proxy Robo
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 477 Slow and Steady Mutation # 476 Charnel House Mutation # 475 Hard Target Mutation # 474 Futile Resistance
Brood War
General
ASL20 Preliminary Maps BGH Auto Balance -> http://bghmmr.eu/ Recent recommended BW games BW General Discussion FlaSh Witnesses SCV Pull Off the Impossible vs Shu
Tourneys
[Megathread] Daily Proleagues [BSL 2v2] ProLeague Season 3 - Friday 21:00 CET Small VOD Thread 2.0 [BSL20] ProLeague Bracket Stage - Day 4
Strategy
I am doing this better than progamers do. [G] How to get started on ladder as a new Z player
Other Games
General Games
Path of Exile Nintendo Switch Thread Stormgate/Frost Giant Megathread Beyond All Reason What do you want from future RTS games?
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
Things Aren’t Peaceful in Palestine US Politics Mega-thread UK Politics Mega-thread Russo-Ukrainian War Thread Vape Nation Thread
Fan Clubs
Maru Fan Club Serral Fan Club
Media & Entertainment
Korean Music Discussion [Manga] One Piece
Sports
Formula 1 Discussion 2024 - 2025 Football Thread NHL Playoffs 2024 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
A Better Routine For Progame…
TrAiDoS
StarCraft improvement
iopq
Heero Yuy & the Tax…
KrillinFromwales
I was completely wrong ab…
jameswatts
Need Your Help/Advice
Glider
Trip to the Zoo
micronesia
Customize Sidebar...

Website Feedback

Closed Threads



Active: 32108 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
BSL: ProLeague
18:00
Bracket Stage: Day 3
Hawk vs UltrA
Sziky vs spx
TerrOr vs JDConan
ZZZero.O174
LiquipediaDiscussion
CSO Cup
17:00
#80
Liquipedia
Cheesadelphia
15:00
Cheeseadelphia 2025
CranKy Ducklings491
davetesta76
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
BRAT_OK 106
MindelVK 48
StarCraft: Brood War
Britney 22186
Calm 4264
Rain 3041
Horang2 1547
ZZZero.O 174
Nal_rA 131
Dewaltoss 118
JulyZerg 59
Rock 38
scan(afreeca) 22
[ Show more ]
Terrorterran 13
IntoTheRainbow 8
Dota 2
Gorgc7771
qojqva2439
LuMiX1
League of Legends
Grubby2839
Dendi1596
JimRising 856
Counter-Strike
fl0m6446
olofmeister3096
Super Smash Bros
Mew2King107
Heroes of the Storm
Khaldor672
Liquid`Hasu607
Other Games
tarik_tv51621
gofns25920
C9.Mang0502
DeMusliM409
crisheroes402
B2W.Neo148
TKL 120
ArmadaUGS87
Trikslyr66
Organizations
Dota 2
PGL Dota 2 - Main Stream9368
Other Games
gamesdonequick1216
EGCTV1057
StarCraft 2
angryscii 42
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 19 non-featured ]
StarCraft 2
• printf 70
• 3DClanTV 37
• Adnapsc2 26
• tFFMrPink 15
• Kozan
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• IndyKCrew
• LaughNgamezSOOP
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• C_a_k_e 3026
• WagamamaTV360
• Ler102
Other Games
• imaqtpie1228
• Shiphtur378
Upcoming Events
GSL Code S
13h 6m
Rogue vs herO
Classic vs GuMiho
Sparkling Tuna Cup
15h 6m
WardiTV Qualifier
21h 6m
BSL: ProLeague
23h 6m
Bonyth vs Dewalt
Cross vs Doodle
MadiNho vs Dragon
Replay Cast
1d 5h
Wardi Open
1d 16h
Replay Cast
2 days
Replay Cast
2 days
RSL Revival
2 days
Cure vs Percival
ByuN vs Spirit
RSL Revival
3 days
herO vs sOs
Zoun vs Clem
[ Show More ]
Replay Cast
4 days
The PondCast
4 days
RSL Revival
4 days
Serral vs SHIN
Solar vs Cham
Replay Cast
5 days
RSL Revival
5 days
Reynor vs Scarlett
ShoWTimE vs Classic
uThermal 2v2 Circuit
5 days
SC Evo League
6 days
Circuito Brasileiro de…
6 days
Liquipedia Results

Completed

Proleague 2025-06-11
BGE Stara Zagora 2025
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
KCM Race Survival 2025 Season 2
NPSL S3
Rose Open S1
CSL 17: 2025 SUMMER
2025 GSL S2
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
YaLLa Compass Qatar 2025
PGL Bucharest 2025

Upcoming

Copa Latinoamericana 4
CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
K-Championship
SEL Season 2 Championship
Esports World Cup 2025
HSC XXVII
Championship of Russia 2025
BLAST Open Fall 2025
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.