Developing Games on the Raspberry Pi by Seth Kenlon
Author:Seth Kenlon
Language: eng
Format: epub
ISBN: 9781484241707
Publisher: Apress
-- draw table background
ground = love.graphics.newQuad(0,0,WIDE,HIGH,150,150)
tile = love.graphics.newImage('img' .. d .. 'tile.jpg')
tile:setWrap('repeat','repeat')
end
The first card you generate is the “top” of the draw deck for the player. Since it’s the back of a card, it has no color or value, so you pass in the "c" and "v" dummy values, which the card library ignores once it sees that the card being generated is of the back type. The card’s X position is set at the left plus the value of pad, a variable set in main.lua to provide padding around the edges of the screen. The card’s Y position is calculated from the height of the screen.
The card generated is added to the back table. Then the same variable is used to generate a second card to represent the AI’s draw deck, using new X and Y values so that the card’s placement is in the top right (across the virtual table) instead of the bottom left. This second card is also added to the back table.
Finally, a proper tabletop is defined. Currently, the game mode only renders a flat color in the background, but Battlejack deserves something more exciting. Rendering an array based on a texture or pattern is pretty common for a game engine, and LÖVE provides the love.graphics.newQuad function to map tiles across a given space. Specifically, this code defines a quad of the width and height of the screen, with tiles sized 150×150 pixels (which happens to be the size of the tile pattern included with the source code of this book). The tile is defined using the d variable to ensure compatibility with whatever system the game is running on, and the tile mode is set to wrap seamlessly across all available space.
Currently, nothing calls the game.setup() function, so trigger it at the end of the game.new() function, since a user starting a new game certainly expects their game to be set up. game.setup()
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Coding Theory | Localization |
Logic | Object-Oriented Design |
Performance Optimization | Quality Control |
Reengineering | Robohelp |
Software Development | Software Reuse |
Structured Design | Testing |
Tools | UML |
Deep Learning with Python by François Chollet(12568)
Hello! Python by Anthony Briggs(9913)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9795)
The Mikado Method by Ola Ellnestam Daniel Brolund(9777)
Dependency Injection in .NET by Mark Seemann(9337)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8295)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7054)
Microservices with Go by Alexander Shuiskov(6817)
Practical Design Patterns for Java Developers by Miroslav Wengner(6734)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6675)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6409)
Angular Projects - Third Edition by Aristeidis Bampakos(6079)
The Art of Crafting User Stories by The Art of Crafting User Stories(5607)
NetSuite for Consultants - Second Edition by Peter Ries(5547)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5347)
Kotlin in Action by Dmitry Jemerov(5062)
