- GameMaker Cookbook
- Brandon Gardiner
- 526字
- 2021-07-30 09:52:48
Introduction
If someone gives you a videogame controller and asks you to play the game, your first question would likely be "How do I play?" This is a simple way of asking "How do I control what I see on the screen?" A game's controls are a major part of the gameplay as your player's input essentially determines everything. An otherwise good game can be rendered unplayable by an awkward or overly complicated control scheme. This is compounded by the push toward touch controls that, especially in the mobile game market, demand a simple interface with a lot of developers opting for a one-touch gameplay.
Just because game controls are trending toward simplistic, it doesn't mean you need to shoehorn your game to work in this fashion. The most important thing about your control setup is that it needs to fit to your game's style. You won't see one-touch controls on a first-person shooter just like you won't see a memory game that requires two joysticks and eight buttons; it just doesn't make sense. For this reason, we're going to take a look at several control options, including touch controls, in order to give you the tools you need to make a game that feels right.
Let's take a quick look at the controls we have at our disposal.
Keyboard controls
Do you have a computer? If so, there are chances that you have a keyboard to go with it. Let's put it to work with some simple movement code by:
- Creating 2D movement
- Adding a Run button
- Making your character jump
Mouse controls
Your mouse is an incredibly versatile peripheral utilized by almost every modern program. If you've ever played a game on your computer, it's almost guaranteed that you've used your mouse at least for one. We'll look at how we can implement mouse controls for gameplay with:
- Using a point-and-click interface
- Following the cursor
Gamepad controls
PC games have been using gamepad controls for years. Today, gamepads are supported by many other operating systems, including Android, iOS, and even HTML5. Because of this, GameMaker is also compatible with them, which means that you can create a console experience for all sorts of games. Let's look at how GameMaker handles:
- Setting up a controller
- Utilizing analogue joystick acceleration
Touch controls
Touchscreens have been commercially available since 1983. Since then, the technology has come a long way and mobile devices, such as smartphones and tablets, have made touchscreens their primary mode of interaction. If you hope to get on the hundreds of games that are released for these platforms daily, you'll need to know a thing or two about touch controls. We'll learn about touch controls by:
- Adding tap control
- Using swipes
Tilt controls
Tilt controls are not always the best means of moving a character or object in a game but, used correctly and sparingly, can add much needed fun and excitement. This example will give you a good idea of how to create tilt controls for your game, but it's up to you to decide how (or if) you'll implement them. This includes the following:
- Moving characters or objects by tilting a device
- Advanced Machine Learning with Python
- Building Mobile Applications Using Kendo UI Mobile and ASP.NET Web API
- SSM輕量級(jí)框架應(yīng)用實(shí)戰(zhàn)
- VMware虛擬化技術(shù)
- Terraform:多云、混合云環(huán)境下實(shí)現(xiàn)基礎(chǔ)設(shè)施即代碼(第2版)
- Python機(jī)器學(xué)習(xí):預(yù)測(cè)分析核心算法
- Python Essentials
- PHP編程基礎(chǔ)與實(shí)踐教程
- JavaScript應(yīng)用開發(fā)實(shí)踐指南
- Hadoop大數(shù)據(jù)分析技術(shù)
- Instant jQuery Boilerplate for Plugins
- 30天學(xué)通C#項(xiàng)目案例開發(fā)
- 高效使用Greenplum:入門、進(jìn)階與數(shù)據(jù)中臺(tái)
- Java程序設(shè)計(jì)實(shí)用教程(第2版)
- Python 3快速入門與實(shí)戰(zhàn)