Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

PQ93

a fantasy console for making small games · By int16_t

Beginner

A topic by Brooccooli created Jun 11, 2020 Views: 223 Replies: 3
Viewing posts 1 to 3

Iv'e only really know c# but I'm trying to learn but I wish there could be some more in the manual about how to use btn input in the code.

I do:

if btn 's'

       x +=5


but it doesn't do anything

i use the x in the txt so im trying to make a letter move

Developer (1 edit)

Hi! The input buttons don't correspond directly to the keyboard, sorry for the confusion.

 I should support this with a function called "key" or something, probably.

"btn" provides a, b, x, y, select, start, and directional buttons.

to check the arrow keys, you can do something like this:

if btn 'u'  -- up
  y -= 1
elseif btn 'd' -- down
  y += 1
elseif btn 'l' -- left
  x -= 1
elseif btn'r' -- right
  x += 1
end

Edit: Also! You can find the full input mapping for keyboard + controllers in the manual :) 

(1 edit)

New question, Does math.random work?  


and is there in anyway I can bugtest my code because when i write run it just freezes until i press ESC, no error message or nothing

(1 edit)

iv'e done that but it doesn't seen to work. I have written the if's in the update method and im trying to draw an 'A' on the screen but it won't change place.

And I'm guessing I shouldn't have to use a loop because the engine loops the code. So how do I make the 'A' change place?


Edit: I solved it. Didn't relize that I had put my variables in the _init instead of class variables