Editorial

Hello again,

Welcome to our second newsletter.  It's been another busy month again for the GCS store as well as our community.

We've been listening to you, our customers and we've been making a number of store improvements. Most of these this month are behind the scenes changes or aimed at supporting our artists, so you may not see much obvious, but we expect the changes to have a trickle down effect, improving the store experience for everyone.

We also have a lot of new media to showcase, we're seeing some very active and skilled artists at the moment, as well as the return of a few of our older faces and we're sure that you will be inspired by some of the media we have to showcase for you this month.

We also have a great new game to showcase for you from the very talented "Wolf". This cyberpunk inspired first person shooter is not only an amazing looking game, but we're proud to say that as well as a large amount of custom media, it takes advantage of a few of the 10,0000 + model available from the GCS Store. We'll be showcasing a small selection of these for you later.

Now, We're sure you're all looking forward to seeing what's going on, so without further ado, let's go...

Looking for 2D Artists.


We are constantly looking for new media to support our growing range. This month, we'd like to encourage artists to upload more 2D media, retro and 2D games are massively popular now and this trend doesn't look like it's going to slow anytime soon. If you're a 2D artist and you're either already a store artist or you're looking for a new outlet for your media, why not get uploading or sign up now.

We are also keen to see some of you 3D artists convert your media into a 2D format. Rendered media is always in demand, and looking at the 10,000 plus 3D models already on the store, we know many of them would be ideal converted to either side on, top down, or isometric views.

In other, related news, the store now supports GameGuru's new 16 texture feature. So, you can now upload compatible textures as landscapes, helping developers to really make their levels really shine.

Acythian



This month's game teaser comes from the very talented TheGameCreator forum user, and established game developer Wolf.  Acythian is being developed using the GameGuru engine, and whilet still in development, is proving once again how much can be achieved with hard work and some clever level design.

Wolf describes the game:

"A retired special forces agent infiltrates the headquarters of
a religious cult to rescue his prodigal foster daughter.
Hereby being unwillingly dragged into a widespread conspiracy.

As a linear, narrative driven game, Acythian builds on lore and
atmosphere to draw haunting science fiction environments and
believable, fleshed out characters that inhabit this world.
The game is set in a distant future where humanity has been
starkly decimated by drawn out wars and nature is regaining
a lot of territory. "


Let's take a look at a couple of screenshots.





All of us here at the GCS wish Wolf well with this projects and it is continues down it's current route it should be something amazing. If you would like to know more about this excellent game and would like to help support its development, you can find out more indiedb.com

[url=http://www.indiedb.com/games/acythian]www.indiedb.com/games/acythian
[/url]

Store News

We're seeing a lot of new media coming through the store approval system at the moment,  pushing us closer and closer to 11lk available items which is great news for all of our customers.  However, this month we're going to focus on a couple of our established artists and take a look at some of the their older media.

First off, let's take a look at some great work from established artist Wizard of Id, whose models, you can also see featured in our early peek at Acythain. WOI's excellent SCI-FI walls pack, designed for GameGuru but once again, ideal for almost any engine with a little conversion work, is perfect for a host of games set in the future.



Also being showcased this month and in keeping with the SCI-FI theme, let's take a look the models of  J Forth Designs. His classic, cartoony style makes for a really unusual look, and reminds us here at the store of the comics of the 1980's and 1990's.


Invaders Tutorial


Welcome again to the second installment in our invader tutorial written in AppGameKit.  If you recall, we've left it last month having written our player movement and invaders movement. We have the basics of a game, but as we can't fire and weapons, or just as importantly, our nasty little invaders can't shoot back, we've still got some way to go, so let's take a look at adding some firepower.

In case you've mislaid last month's tutorial, or you missed it,  we've copied the full code from last months below.



// Project: galaxy
// Created: 2017-03-08

// show all errors
SetErrorMode(2)

// set window properties
SetWindowTitle( "galaxy" )
SetWindowSize( 1024, 768, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window

// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
SetOrientationAllowed( 1, 1, 1, 1 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 60, 0 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts

//we'll set up a TYPE for the 'invaders'
// x and y are the aliens position and are both floats (allowing decimals)
// active holds a flag to say if the alien is active (still alive)
// sprite will hold the sprite number
type aliens
x as float
y as float
active as integer
sprite as integer
speed as integer
endtype

//we will use a single variable to indicate the direction the invader 'mob' moves.
//If a single invader reaches the edge all invaders will change direction.
global aliendirection=1

//load the alien image into image 1 (This image should have been placed in your media folder
loadimage(1,"alien.png")


//set up an array for the aliens called invaders
//we are allowing 60 which is 12x5
//arrays are always global and can be referenced from any function
dim invaders[60] as aliens

//let's make some aliens.
//first we'll set up some tempoary varible to hold the invaders position on screen and a value for the start of the sprites we'll use.

x=32
y=64
tsprite=100

//run though all 60 invaders and give them a screen position and a sprite
for setupinvaders=1 to 60

//we'll assign some values to some varibles, defining position, activity, speed and the all important sprite number
invaders[setupinvaders].x=x
invaders[setupinvaders].y=y
invaders[setupinvaders].active=1
invaders[setupinvaders].speed=2
invaders[setupinvaders].sprite=tsprite
//create the sprite
createsprite(tsprite,1)
//the sample sprite is animation, so let's set that up
SetSpriteAnimation(tsprite,64,64,4)
//now the sprite has some animation data, we can simply play it.
PlaySprite(tsprite)
//Ok, no real need to set the sprite po
SetSpritePosition(tsprite,invaders[setupinvaders].x,invaders[setupinvaders].y)

inc tsprite,1

inc x,64

if x>786
  x=32
  inc y,64
endif

next setupinvaders
// play is a new type which will hold the player information. As above x and y are the players postion and sprite will hold the sprite number.
type play
x as float
y as float
sprite as integer
endtype

//we'll now set up a global and link it to the play type. Note that this is a global, so that it can be referenced by every part of the code.
global player as play
//now let's define some start values.

player.x=512
player.y=700

//and we'll use sprite 2 and image 2 for the player ship.

player.sprite=2

loadimage(player.sprite,"playership.png")
createsprite(player.sprite,player.sprite)
SetSpritePosition(player.sprite,player.x,player.y)

//currenttime will hold the time in milliseconds for the current frame. Calling GetMilliSeconds() is processor intensive and this will aid performance
//by only calling the function once is a frame

global currenttime as integer
global frameadjust as float

do

//find out how fast we should move to ensure that 60fps is replicated.
frameadjust = 60*GetFrameTime()
//store current milliseconds for performance.
currenttime=GetMilliseconds()
//move those invaders!
moveinvaders()
//draw them again
drawinvaders()
//let's move the player around a bit
controlplayer()
//and draw the players ship again.
drawplayer()

Sync()
loop

//this function will move the invaders and control movement up and down the screen.

function moveinvaders()

//let's set up a couple of variables to decide when to change the movement direction
changedirection=0
movedown=0

//we'll run through the invaders one at a time

for moveinvaders=1 to 60
  //but only if they are active, at first they all will be but if they are destroyed they'll become inactive.
  if invaders[moveinvaders].active=1

//move the invaders in the movement direction, at the correct speed adjusted for slower systems.
inc invaders[moveinvaders].x,aliendirection*(invaders[moveinvaders].speed*frameadjust)

//if any invader is at the right of the screen reverse direction for them all
if invaders[moveinvaders].x>960
changedirection=-1
endif

//if any invader is at the left of the screen reverse direction for them all
if invaders[moveinvaders].x<1
movedown=1
changedirection=1
endif

  endif

//move onto the next invader
next moveinvaders

//are the invaders changing direction, if they are reset the movement direction variable
if changedirection<>0
  aliendirection=changedirection
endif

//if they are at the far left of the screen they will also move down
if movedown<>0
  for down=1 to 60
if invaders[down].active=1
inc invaders[down].y,12
endif
  next down
endif

endfunction

//a very simple routine which just update the invaders position, we are using a seperate function for ease of use
//and to aid the addition of features in the future.

function drawinvaders()
//loop through them all
for draw=1 to 60
        //only bother drawing them if they are active to save performance
  if invaders[draw].active=1
SetSpritePosition(invaders[draw].sprite,invaders[draw].x,invaders[draw].y)
  endif
  //move on to the next
next draw

endfunction

//ok, this is where we scan for input to see if the player is trying something exciting.

function controlplayer()

//this is where all player actions take place, as this is an invaders type game, that will be
//moving left and right and later on, firing.
//let's read the keyboard, for this demo, we'll use the arrows to move

//You can find all of the codes for the keys here: https://www.appgamekit.com/documentation/guides/scancodes.htm

//The scancode for left is 37, so let's see if left is pressed

if GetRawKeyState(37)
  //if left is pressed we adjust the player.x value by a negative amount,remembering to adjust for frame rate
  player.x=player.x-4*frameadjust
endif

//The scancode for left is 39, so let's see if right is pressed
if GetRawKeyState(39)
  //if right is pressed we adjust the player.x value by a positive amount,remembering to adjust for frame rate
  player.x=player.x+4*frameadjust
endif

endfunction

function drawplayer()

//make sure the player can't leave the screen

//first left hand side,
if player.x<1 then player.x=1
//then right hand side
if player.x>960 then player.x=960

//ok, job done, let's update the sprite position
SetSpritePosition(player.sprite,player.x,player.y)

endfunction

Now let's carry on with building our game.

We'll need to add a new type and a new array to store our invader missiles, so let's do that now.

Add this code after the custom type aliens:

//Create a new custom type for our invader fire.
type alienfire
 x as float
 y as float
 active as integer
 sprite as integer
 speed as float
endtype

//Make an array, we will allow 60, one shot for each invader.
dim afire[60] as alienfire
[/code]


We'll need to load in an image for the alien lasers, so let's add one. You can either create your own using an art package (if so, it should 24x29 pixels), or use this one. (Just copy and paste it into your media folder, you might need to rename it. Call it alienfire.png)





Ok, so after the line where we loaded the invader image, let's load our alien fire sprite.
[code]
//Let's load an image for the alien fire.

loadimage(3,"alienfire.png")


Okay, now that we've got an image, let's create some sprites.  We can add the code to create the sprites just before the main DO - LOOP
 
//Create alien fire.
//We'll use sprites 200 - 260

tsprite=199
For makelaser=1 to 60
 afire[makelaser].sprite=tsprite
 CreateSprite(tsprite,3)
 //Let's set this sprite off screen
 SetSpritePosition(tsprite,-1000,-1000)
 inc tsprite,1
Next makelaser


This would be a good time to save your code. This is always a good idea and will save you a lot of frustrating moments and extra work.

Now let's make a couple of functions to create and move some alien firepower.

Function makelaser(invader)

usethisone=0

For find=1 to 60
  If afire[find].active=0
usethisone=find
find=61
  Endif
Next Find

If usethisone<>0
  //We set the alien fire start position based on the invader position.
  afire[usethisone].x=invaders[invader].x+16
  afire[usethisone].y=invaders[invader].y+16
  //make it active
  afire[usethisone].active=1
  //and we'll give it a random speed
  afire[usethisone].speed=random(2,4)
EndIf


EndFunction

Function movelaser()

For movelaser=1 to 60
  If afire[movelaser].active=1
inc afire[movelaser].y,2*afire[movelaser].speed
SetSpritePosition(afire[movelaser].sprite,afire[movelaser].x,afire[movelaser].y)

//If the alien fire is off screen, make it inactive
//and available to be used again.
If afire[movelaser].y>780
afire[movelaser].active=0
EndIf

  EndIf
Next movelaser

EndFunction



We will need to call this at a couple of points. Firstly to actually make the invader fire.

Add this code to the moveinvaders() function, just before the last Endif


/
/There is a chance the invader will fire. Let's say every 1000 frame on average.
randomchance=Random(1,1000)
If randomchance<2
 makelaser(moveinvaders)
EndIf


We'll also need to call the movelaser() function to update our alien bullets.

Add this just before the Sync() in the main DO - LOOP.

 //Let's control any alien fire
movelaser()


Save this and we're finally ready to give it a run. If all has gone well, you should see something like this.




If you're not seeing something similar, or your code fails to compile. Read back through this tutorial so far.

Okay, providing all has gone well, you'll be able to move around while the invader rain laser death at you. You'll notice in a few moments, that you can't actually be harmed or return fire. So let's look at that.

For now we'll add a simple collision check to our movelaser() function, We'll add it just before the final EndIf and after the check to see if our alien bullet has left the screen
.
//Has the player been hit.
If GetSpriteCollision(player.sprite,afire[movelaser].sprite)
 player.x=512
 player.y=700
EndIf


We will expand on this next month, but for now, all we'll do it reset the player ship position.

Next month, we will add some player fire and look at how to generate some explosive effects. Until then,  why not play around with the code and see if you can add your own improvements.

Signing Off



Well, that's it for this month. Next month, we'll be returning with some more tutorials, much more store news as well as lots of other bits and pieces.

See you soon,

The GCS team.