Disclaimer: Title is catchy but true. App in this article was created with Angular implemented with TypeScript but you can follow it’s architecture and replicate it with Vanilla JavaScript.
You may have some cool idea in your head, or you want to have just an app between your friends that does X. There may be many reasons. What is common between them, that path to your own app is fun and educational. Just about anybody can learn a lot - if you are Senior coder with mustach :olderman: you can make your app with a new framework to get to know it! If you are not even Junior programmer then I’m just showing you that there is a resource / possibility of creating an app with one of the most popular and forgiving ( or should I say - beginner friendly ) languages out there. No more excuses! Me, personally, I just wanted to have my own app in Google Store, that’s it. You don’t need more! Each tier of experience will of course benefit from this in another way. If you’re starting your journey it might be an ambitious task but it’s not impossible. Some time ago I didn’t even know that it’s possible to make an App without knowing Java or some advanced Wizardy :crystalball:
Currently there is more than a few frameworks that provide compiling from non-native code to an app bundle that you could upload to Google Shop or Apple Store. Just to name the most popular in random order:
The Ionic 4 as a project has started with Angular architecture as a spine for App development but with time they have added support for different frameworks (Vue, React, Angular). While writing your code inside components you CAN you can also Vanilla JavaScript.
Becauses I have already some Angular knowledge and the Ionic CLI provides very useful tools for creating the scaffold for it I picked up the Angular way of doing things. On the official website you have a great and beautiful tutorial on how to start your own App with just 2 commands. Great community and a few years of presence on the market gives you a lot of resources to study. I’ve used extensively Simon Grimm’s youtube chanel where you can find virtually anything about Ionic (Thank You Simon) !
As I menationed before, my main goal it to have an app. The byproduct is the knowledge I will gain in the meantime. The goal is not that complicated - I don’t want to earn money off it, nor change the world so the app should be pretty simple. I came up with an idea of a picture game - You get a pixelized picture and you need to guess what’s on the picture. Can be extended with different settings like difficulty (amount of pixelization, languages etc).
Sketches needs to be make for general planning - in order to save time.
The app has already been made, so if you want to see how it works you can check it on Android.
There will be one top-level module (1 router) controlling all the pages’ modules.
The app will consist of 4 pages (views with specific content binded to a route):
There will be no backend, no API so all the data will be saves in the application’s state. Angular for managing the state of apps uses services so I will make a service responsible for:
Usage of 3rd party library will be necessary for:
const routes: Routes = [
{ path: "",
loadChildren: "./start/start.module#StartPageModule"
},
{
path: "gameplay",
loadChildren: "./gameplay/gameplay.module#GameplayPageModule"
},
{
path: "settings",
loadChildren: "./settings/settings.module#SettingsPageModule"
},
{
path: "gameover",
loadChildren: "./gameover/gameover.module#GameoverPageModule"
}
];
Start Game Page - the most important things it consists of are:
All the buttons are nested in a Footer
Start Game Button:
<!-- start.page.html -->
<!-- ... -->
<ion-toolbar color="success" (click)="startGame()">
<ion-title>Start Game</ion-title>
<ion-buttons slot="end">
<ion-icon name="arrow-dropright-circle"></ion-icon>
</ion-buttons>
</ion-toolbar>
<!-- ... -->
StartGame button calls a function that using services (custom one and router) resets all game progress (gained points in previous sessions, used hints)
// start.page.ts
// ...
startGame() {
this.settingsService.resetAllNewGame();
return this.router.navigateByUrl('/gameplay');
}
// ...
Settings Button: Uses just a Router to navigate to a Settings Page:
<!-- start.page.html -->
<!-- ... -->
<ion-toolbar color="secondary" [routerLink]="['/settings']">
<ion-title>Settings</ion-title>
<ion-buttons slot="end">
<ion-icon name="settings"> </ion-icon>
</ion-buttons>
</ion-toolbar>
<!-- ... -->
Share Game Button: Uses the mentioned capacitor library that enables native functionalities of sharing:
<!-- start.page.html -->
<!-- ... -->
<ion-toolbar
color="primary"
onclick="window.plugins.socialsharing.share(
'Check out PixelatedFun app!',
'Imagine what is hidden!',
null,
'https://pixelated.fun')"
>
<ion-title>Share</ion-title>
<ion-buttons slot="end">
<ion-icon name="paper-plane"> </ion-icon>
</ion-buttons>
</ion-toolbar>
<!-- ... -->
Settings Page - place for adjusting difficulty etc:
<!-- settings.page.html -->
<!-- ... -->
<ion-list>
<ion-item>
<ion-label>Difficulty</ion-label>
<ion-select
[(ngModel)]="selectedDifficulty"
(ionChange)="changeDifficulty()"
[placeholder]="this.difficulty"
>
<ion-select-option value="easy">Easy</ion-select-option>
<ion-select-option value="normal">Normal</ion-select-option>
<ion-select-option value="hard">Hard</ion-select-option>
</ion-select>
</ion-item>
</ion-list>
<!-- ... -->
Some of the takeouts from this projects are:
Did you learn anything reading this post? Tell me about your insights. You are most welcome to see more posts of this type - just go to home page