u/Fit_Flatworm5004

Not understanding why my code wont work...

So im attempting to make a dialogue system, in which I would have an array that contains a struct to hold the string, and the sprite of the speaker. So inside a script I have :

global.text = [];

global.text[0] = { str : "Pls work!" , spr : sRed }

Then, in another script, I have a function that takes in a number value so then it could respond to however many other arrays I may have.

function startDialogue(_arv) {

var _str = global.text[_arv].str

var _spr = global.text[_arv].spr

draw_text(240 , 135 , _str) // x and y values are just half the room size on their respective axis so itll be in the middle of the screen.

I then have an object, which is placed in the room, which upon "enter key pressed" would run

startDialogue(0)

The idea here is that id be able to put in any array value, and the startDialogue function would take that array value, and then be able to print the text( I know nothing is there for the sprite yet and thats because I wanted to make sure the text worked first.) but, when I run the instance and press enter, nothing happens, theres no errors within any of the scripts and within the output.

So, what's wrong with my current code? and, if you believe you have a better way of making dialogue please let me know, I am still a beginner though and Im honestly confused as to why my method isnt working as I thought it seemed fairly simple. Thank you for your help in advance.

reddit.com
u/Fit_Flatworm5004 — 4 days ago

How to code a roguelike deck-builder

So I'm currently in a game jam, which is about a month long so I should be fine, and had the idea to make a roguelike deck-builder similar to slay the spire(I haven't played 2 so don't spoil if there is any differences unless you deem necessary). I was wondering how others would go about coding a project like this, primarily how to drag and drop the card from my deck, activating the card, and randomizing which enemies you encounter and the items you get after said encounters. As of now those are the issues I think i need solving, but if you have anything else that may help id appreciate that too. Thank you for your help in advance.

reddit.com
u/Fit_Flatworm5004 — 1 month ago