BASIC8
Not enough ratings
A simple first game(bigginer) and other help
By Doom Destroyer
This guide will teach you how to make a simple cheese clicker included is, a input system ,basic update ,init ,upgrade ,variable change ,sprites
   
Award
Favorite
Favorited
Unfavorite
a simple clicker game base
this is a simple clicker with the e button for input
coins$ = 0
gains$ = 1
def update(delta)
coins$ = coins$
text 0, 30,coins$, rgba(255, 255, 255)
if keyp asc("e") then coins$ = coins$ + gains$
enddef
update_with(driver())
This is an updated version due to the last one not working
Controls when pasted is e to gain coins
how to make sprites show
how to load a sprite
for a sprite to work you will need to know how spr works basically
spr has a name of the resource. so use the command below to load resources
shovel = LOAD_RESOURCE("shovel.sprite")
spr shovel,x,y

how to set sprites x and y
now the x and y need to be filled in, in order to show it on screen. there's two main ways, the first is to create two variables for lets a say a player sprite
px$ = 20 'player x
py$ = 10 'player y
spr player,px$,py$
or for a more manual approach
spr shovel, 20, 50,

rotation
lets say you want a Asteroid game clone
pr$ = 10 'player rotation
spr ship,px,py,r = pr$
if key asc("e") then pr$ = pr$ +1
this will allow the ship to rotate but don't add it unless needed
How to change more then one variable with an if statement
Have you wondered why. if 1=1 and 2=2 then a=true b=false 'why does this not work, its because having more then one variable change in an if statement does not work. so this solution uses one variable to change two as shown below.

Example
qpress$ = 0
coins$ = 30
gains$ = 1
def update(delta)
text 0, 30,coins$, rgba(255, 255, 255)
text 0, 40,gains$, rgba(255, 255, 255)
if keyp asc("q") then qpress$ = 1 'begin
if coins$ > 19 and qpress$ > 0 then gains$ = gains$ + 1 'variable one
if coins$ > 19 and qpress$ > 0 then coins$ = coins$ - 20 ' variable two
if keyp asc("q") then qpress$ = 0 'end
enddef
update_with(driver())
Random function and how it works
the rnd function used two number rnd(a,b) so by having rnd(1,2) would be a coin flip another example as shown below.

Example
attack$ = 0

def update(delta)
text 0, 30,attack$, rgba(255, 255, 255)
if keyp asc("e") then attack$ = rnd(1,10) ' this will get a number between 1 and 10
enddef
update_with(driver())

note
having rnd(1,1) won't work due to it being the same number rnd(0,1) won't work due to the minimum being lower then the maximum.
Some basics to help you understand this guide
basics
coins$ is a variable
coins$=10 this makes it == 10
text
text 10,0 this is the x,y location on screed
text 10,0,hello ...this is what will show
text 10,0,hello rgba(255, 255, 255) the rgba is what will add colour
text 10,0,hello rgba(red, green, blue) this shows what values that can be changed

variables can be added to text to show the variable this is great for debugging.
text 10, 0,coins$, rgba(255, 255, 255)
so the text will show that coins$ = 10
SFX and how to do sound
wav = wave() 'this function is where the name of the SFXi s done
push(wav, 2, 261.63, 0.25, 1)
push(wav, 2, 261.63, 0.25, 1)
push(wav, 1, 329.63, 0.25, 1)
push(wav, 1, 329.63, 0.25, 1) 'these are the notes played during the SFX being played
tick$ = 1 ' this will be used in order to stop it repeating really quickly and sounding bad

This example shows a tick system being used to make sure that the sound is played consistently and in time.

def update(delta)
tick$ = tick$+1
if tick$ > 100 then sfx wav 'this plays the SFX
if tick$ > 100 then tick$ = 1
enddef
update_with(driver())
How to save Data/numbers
the main function being used is persist. persist automatically saves the variable being stored, it can save a "string" or a number an example being

but by adding persist it will save highscore as 10
persist highscore$=0
score$=10
def update(delta)
highscore$=score$ after closing highscore will equal then 10
enddef
update_with(driver())

highscore$=0
score$=10
def update(delta)
highscore$=score$ after closing highscore will not equal 10
enddef
update_with(driver())


notes
persist works for global variables so it can not use local score$=10 for an example
Mget and how it works game example
(https://steamcommunity.com/sharedfiles/filedetails/?id=3546089654) game link steam

doop = LOAD_RESOURCE("doop.sprite")
villege = LOAD_RESOURCE("villege.map")
scene$=20 ' sets scene

px$=40
py$=88
oldx$=40
oldy$=88
parmor$=1
pweapon$=1
pmove$=8

def update(delta)
oldx$=px$
oldy$=py$
if scene$=20 then map villege ,0,0 'maps using the scene number to change map
if scene$>19 then spr doop ,px$,py$-2

if keyp asc("s") then py$=py$+8
if keyp asc("w") then py$=py$-8
if keyp asc("d") then px$=px$+8
if keyp asc("a") then px$=px$-8

if scene$=20 then h = mget villege,0,px$/8,py$/8 ' this makes coliding happen
if h=1 then
px$ = oldx$
py$ = oldy$
endif

if scene$=20 then h = mget villege,0,px$/8,py$/8 'farmer dave house
if h=2 then
px$ = oldx$
py$ = oldy$
endif



enddef
update_with(driver())
11 Comments
pateatraseros Apr 28, 2024 @ 9:23pm 
thanks..
Doom Destroyer  [author] Apr 23, 2024 @ 7:33pm 
glad it helped ill see what i can do with mset and mget collisions
pateatraseros Mar 30, 2024 @ 2:13am 
it helped me a lot, thanks, canyou upload a guide using mget, mset, to do collisions...again thanks
Doom Destroyer  [author] Jan 6, 2023 @ 4:23pm 
well its been a year thank you everyone for the support
Doom Destroyer  [author] Jul 9, 2022 @ 3:01am 
illm do something special for the first year aniversery
Doom Destroyer  [author] Jul 5, 2022 @ 10:44pm 
i will add a section on hoe class functions and objects work when im done figuring it out for my self
Doom Destroyer  [author] Jun 28, 2022 @ 12:58am 
gonna be adding a section on saving data
Doom Destroyer  [author] Apr 22, 2022 @ 4:42am 
Added a new section for SFX I struggled with that one but hay if you found it hard just use my dumb down version
Doom Destroyer  [author] Feb 24, 2022 @ 11:14pm 
just added a section tom help people who are struggling to figure out text and I fixed a few spelling errors
Doom Destroyer  [author] Feb 24, 2022 @ 9:14pm 
ill add a new section soon