Skip to content

Commit

Permalink
Merge branch 'main' into Godot-2D-Platformer
Browse files Browse the repository at this point in the history
Signed-off-by: Abigail Clennell <[email protected]>
  • Loading branch information
clenneabig authored Oct 13, 2024
2 parents f9daa85 + 04ef33b commit 79bcc46
Show file tree
Hide file tree
Showing 53 changed files with 1,822 additions and 240 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/scoreboard-security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: "Checkout code"
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
persist-credentials: false

Expand All @@ -33,13 +33,13 @@ jobs:
publish_results: true

- name: "Upload artifact"
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: SARIF file
path: results.sarif
retention-days: 5

- name: "Upload SARIF results to code scanning"
uses: github/codeql-action/upload-sarif@6db8d6351fd0be61f9ed8ebd12ccd35dcec51fea # v3.26.11
uses: github/codeql-action/upload-sarif@c36620d31ac7c881962c3d9dd939c40ec9434f2b # v3.26.12
with:
sarif_file: results.sarif
2 changes: 1 addition & 1 deletion .github/workflows/trufflehog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4
with:
fetch-depth: 0

Expand Down
26 changes: 22 additions & 4 deletions astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,28 @@ export default defineConfig({
label: "About",
link: 'game-design/index'
}, {
label: "Godot",
autogenerate: {
directory: 'game-design/godot'
},
label: "Godot", items: [{
label: "Godot Basics",
link: "game-design/godot/basics"
},{
label: "Universal Features",
link: "game-design/godot/universal"
},{
label: "Survivors-Like",
link: "game-design/godot/survivors"
},{
label: "Top-down Dungeon Crawler",
link: "game-design/godot/dungeoncrawler/0-scenesetup/"
},{
label: "3D Intro",
link: "game-design/godot/3d"
},{
label: "3D Game",
link: "game-design/godot/3dgame"
},{
label: "Setting up C# For Godot",
link: "game-design/godot/projectsetup"
}],
collapsed: true
}],
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@
"rehype": "13.0.2",
"unist-util-visit": "5.0.0"
},
"packageManager": "[email protected].0"
"packageManager": "[email protected].1"
}
430 changes: 213 additions & 217 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Binary file added src/assets/godot/dungeonCrawler/TextureFilter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/addanim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/animlength.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/animtimeline.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/assets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/autoloop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/basicroomimg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/coinScene.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/collshapeimg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/createdLevel.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/enemyscene.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/eraseTool.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/folders.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/groups.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/idleanim.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/layersimg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/godot/dungeonCrawler/recttoolimg.png
Binary file added src/assets/godot/dungeonCrawler/screenshot.png
Binary file added src/assets/godot/dungeonCrawler/walkanim.png
Binary file added src/assets/godot/dungeonCrawler/wallcolliders.png
Binary file added src/assets/godot/dungeonCrawler/worldScene.png
6 changes: 4 additions & 2 deletions src/components/starlight/Pagination.astro
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
---
import Default from '@astrojs/starlight/components/Pagination.astro';
import type { Props } from '@astrojs/starlight/props';
import { isTutorialEntry } from '../../content/config';
import { getTutorialPages } from '../../util/getTutorialPages';
import { pages } from '../tutorial/TutorialNav.astro';
import { allPages } from '../tutorial/TutorialNav.astro';
const { entry, pagination } = Astro.props;
const { entry, pagination, id } = Astro.props;
const { type } = Astro.props.entry.data;
let { prev, next } = pagination;
const pages = allPages.filter((page) => isTutorialEntry(page, id));
const tutorialPages = getTutorialPages(pages);
if (type === 'tutorial') {
Expand Down
4 changes: 1 addition & 3 deletions src/components/tutorial/ProgressStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,6 @@ export class ProgressStore {
}

private static slugFromPathname(pathname: string) {
// Remove the language segment from the path,
// and strip a trailing slash, if present.
return pathname.split('/').slice(2).join('/').replace(/\/$/, '');
return pathname.replace(/\/$/, '');
}
}
17 changes: 10 additions & 7 deletions src/components/tutorial/TutorialNav.astro
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
import type { Props } from '@astrojs/starlight/props';
import { getCollection } from "astro:content";
import { isTutorialEntry } from '../../content/config';
import { getTutorialPages, getTutorialUnits } from '../../util/getTutorialPages';
Expand All @@ -8,13 +9,11 @@ import TabPanel from '../tabs/TabPanel.astro';
import Progress from './Progress.astro';
import UnitProgressIcon from './UnitProgressIcon.astro';
export interface Props {
id: string;
}
const currentUrl = Astro.url.pathname.replace(/\/$/, '');
const { id } = Astro.props;
export const allPages = await getCollection('docs');
export const pages = allPages.filter(isTutorialEntry);
const pages = allPages.filter((page) => isTutorialEntry(page, id));
const tutorialPages = getTutorialPages(pages);
const units = getTutorialUnits(tutorialPages);
Expand Down Expand Up @@ -58,9 +57,9 @@ const isCurrentUnit = (unit: (typeof units)[number]) =>
{currentUrl.endsWith(lesson.slug) && (
<ul class="on-this-page">
{(await lesson.render()).headings
.filter(({ depth }) => depth <= 2)
.filter(({ depth }) => depth <= 6)
.map((h) => (
<li>
<li class="subheader-link" style={`--depth:${h.depth}`}>
<a class="header-link" href={'#' + h.slug}>
{h.text}
</a>
Expand Down Expand Up @@ -137,6 +136,10 @@ const isCurrentUnit = (unit: (typeof units)[number]) =>
margin-top: -0.125rem;
}

.subheader-link {
margin-left: calc(var(--depth) * 0.8rem);
}

.on-this-page {
margin-bottom: 0.5rem;
}
Expand Down
16 changes: 14 additions & 2 deletions src/content/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { docsSchema, i18nSchema } from "@astrojs/starlight/schema";
import { type CollectionEntry, defineCollection, z } from "astro:content";
import path from 'node:path';

// find all tutorial pages
const baseSchema = z.object({
Expand All @@ -24,11 +25,22 @@ export type DocsEntry<T extends DocsEntryType> = CollectionEntry<'docs'> & {
type DocsEntryType = DocsEntryData['type'];

function createIsDocsEntry<T extends DocsEntryType>(type: T) {
return (entry: CollectionEntry<'docs'>): entry is DocsEntry<T> => entry.data.type === type;
return (entry: CollectionEntry<'docs'>, id: string): entry is DocsEntry<T> => {
if (entry.data.type !== type) {
return false;
}
const currentPath = path.parse(id);
const currentDir = path.dirname(currentPath.dir);

const pagePath = path.parse(entry.id);
const pageDir = path.dirname(pagePath.dir);

return pageDir === currentDir;
};
}

export type TutorialEntry = DocsEntry<'tutorial'>;
export const isTutorialEntry = createIsDocsEntry('tutorial');
export const isTutorialEntry = createIsDocsEntry<'tutorial'>('tutorial');

export const collections = {
docs: defineCollection({ schema: docsSchema({ extend: docsCollectionSchema }) }),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
type: tutorial
unitTitle: Making a 2D top-down dungeon crawler
title: Setting up our scene
description: This page works through 2D top-down dungeon crawler step-by-step
sidebar:
order: 2
---

import Checklist from '/src/components/tutorial/Checklist.astro';
import Box from '/src/components/tutorial/Box.astro';
import { Steps } from '@astrojs/starlight/components';

This is a guide to making a 2-dimensional dungeon crawling game in [Godot](https://godotengine.org/). If you are unfamiliar with Godot, check out the [Godot basics](/game-design/godot/basics) doc as this tutorial assumes basic knowledge of navigating and using the Godot Engine.

:::note[Version]
This guide is up-to-date with Godot 4.3 stable official release, and will likely work with any version of Godot newer than 4.3. Due to the use of **TileMapLayers** which were introduced in 4.3, this tutorial isn't compatible with any version pre 4.3
:::

## What you'll be making

![Screenshot preview of the game](/src/assets/godot/dungeonCrawler/screenshot.png)

In this tutorial, you'll work step by step through creating your very own Dungeon Crawler! In this game, the player will navigate through a multi-level dungeon of your design, full of enemies to fight, and treasure to collect!

You'll learn to:
- Create an animated player character
- Create enemies that chase and attack the player
- Create a User Interface that tracks health and points
- Switch levels
- Design 2D Combat

Let's jump right in!

## Making the project

:::note[Godot Documentation]
Godot Documentation for nodes discussed in this section:

[Importing](https://docs.godotengine.org/en/stable/tutorials/assets_pipeline/import_process.html)
:::


We won't be creating our own assets as part of this project, we'll instead be using a free asset pack by Ox72 on Itch.IO which [can be found here](https://0x72.itch.io/dungeontileset-ii) Just click *Download now* followed by *No thanks, just take me to the download* and download the file called *0x72_DungeonTilesetII_v1.7.zip*

Create a new 2D project, using the Forward+ Renderer.

Let's start by importing our assets!

<Steps>

1. First let's create a new folder, and call it 'Assets'
Then, let's extract the assets from the folder we downloaded, and at them into our Assets folder. Mine looks like this, but it's fine if yours looks slightly different.

![Assets](/src/assets/godot/dungeonCrawler/assets.png)

2. Let's also create two new top level folders called 'Scripts' and 'Scenes'

![Folders](/src/assets/godot/dungeonCrawler/folders.png)

3. To ensure our pixel art assets look crisp and not blurred we'll want to make one quick change.
Using the buttons in the top left of the screen, select **Project -> Project settings** In this menu, select the **General** tab, and scroll until you see the **Rendering** header. Under this, select **Textures**
Change **Default Texture Filter** from **Linear** to **Nearest**

![Folders](/src/assets/godot/dungeonCrawler/TextureFilter.png)
</Steps>

<Box>
## Checklist
<Checklist>
- [ ] I have imported the assets
- [ ] I have setup my folders and changed the settings
- [ ] I'm ready to make a game!
</Checklist>
</Box>
Loading

0 comments on commit 79bcc46

Please sign in to comment.