Hello LÖVERS,
Let me present to you, Source Code: The Game
It is a game where you fly around in a spaceship and edit the source code for the game. So without further ado, the instructions:
Movement: WASD
slow down: Q
Select a letter: right click
replace a letter with the selected letter: left click
Update code: Click the update button
NOTE: If you have run this game before, DELETE THE OLD SAVE FILE BEFORE RUNNING IT AGAIN! If you do not, the game will be running 2 instances of main.lua, so the FPS takes a serious hit. (if anyone knows how to make the code do this automatically, please tell me.)
Credits:
Code: Nsmurf (memberlist.php?mode=viewprofile&u=57522)
Music: Readily Available Ketchup By Zanzlanz (http://www.zanzlanz.com/)
Idea: Ninjasmurf
I am glad to hear any advice/criticism about this.
Another note:
I know of the bug where you click above of below the code, but if you find any others, tell me.
And just to finish off the post, a screenshot (it got a bit washed out, but you get the idea) :
Source Code: The Game
Source Code: The Game
- Attachments
-
- SourceCodeTheGame.love
- Source Code: The Game
- (4.06 MiB) Downloaded 251 times
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Source Code: The Game
The concept is original. And way more weird than I expected ...
I had some fun, though.
Well, you should consider clean your original code, and use a proper indentation, as it isn't that easy to read the way it is, actually.
Maybe you should avoid saving an edited chunk if it couldn't be loaded properly after hitting the update button.
The game can't be restarted later, yielding an err.
Also, you should enhance the controls. Actually, it is pretty complicated to edit the initial source.
Envision to enable keyboard use.
BTW, the message 'the chunk was not loaded properly' must be splitted into two lines at least, as it doesn't fit in the black box.
How the check did you came up with that idea ?
I had some fun, though.
Well, you should consider clean your original code, and use a proper indentation, as it isn't that easy to read the way it is, actually.
Maybe you should avoid saving an edited chunk if it couldn't be loaded properly after hitting the update button.
The game can't be restarted later, yielding an err.
Also, you should enhance the controls. Actually, it is pretty complicated to edit the initial source.
Envision to enable keyboard use.
BTW, the message 'the chunk was not loaded properly' must be splitted into two lines at least, as it doesn't fit in the black box.
How the check did you came up with that idea ?
Re: Source Code: The Game
Wow, i didn't even notice that... Thanks for pointing it out.Maybe you should avoid saving an edited chunk if it couldn't be loaded properly after hitting the update button.
I want to enable keyboard editing, but wasn't exactly sure how to go about it. The only way that i could think of was to get the ascii value of the key that they were pressing, then use some function to turn the ascii value into a character.Also, you should enhance the controls. Actually, it is pretty complicated to edit the initial source.
Envision to enable keyboard use.
Oh, i was meaning to make that say "Syntax error" instead, because that is the only way that i found out how to get that error, but didn't get around to it.BTW, the message 'the chunk was not loaded properly' must be splitted into two lines at least, as it doesn't fit in the black box.
Hehe, yeah. I usually write my code that way, since i don't find it hard to read like that, but it is more standard to indent it, and for a game like this, that's everything.Well, you should consider clean your original code, and use a proper indentation, as it isn't that easy to read the way it is, actually.
Thanks for all the feedback,
Nsmurf
Re: Source Code: The Game
If you get the ascii then you can use string.char(ascii) to turn it into a character.Nsmurf wrote:I want to enable keyboard editing, but wasn't exactly sure how to go about it. The only way that i could think of was to get the ascii value of the key that they were pressing, then use some function to turn the ascii value into a character.Also, you should enhance the controls. Actually, it is pretty complicated to edit the initial source.
Envision to enable keyboard use.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Source Code: The Game
Well, I'm make a proposal, but I'm not sure that's the best solution here, but it can work..Nsmurf wrote: I want to enable keyboard editing, but wasn't exactly sure how to go about it. The only way that i could think of was to get the ascii value of the key that they were pressing, then use some function to turn the ascii value into a character.
You could manage your editor using a regular Lua table.
When you read the whole contents of the main.lua file, you store each single line in a table.
Then you just display all these lines, looping through this table.
Now, editing becomes simple. Whenever a mousepressed event is registered, assuming the x,y position of the mouse at this very moment, we can workout what line is supposed to be edited. This computation should take into account the fact that the lines may scroll (up/down/left/right).
Then all you have to do is catching all keyboards input unicode using love.keypressed, turn them into human-readable characters using string.char, and take into account of specific keys for deleting, line split, etc.
And make advantage of Lua's string library (string.sub will obviously be required a lot, I guess).
You don't have to make a full text editor, only basic stuff is needed here.
Last edited by Roland_Yonaba on Fri Aug 24, 2012 11:26 pm, edited 1 time in total.
Re: Source Code: The Game
Thanks for pointing out love.keypressed.
I already do everything else you describe.
The only problem that i see is that i am using wasd keys to move, so you would need to be not pressing movement keys in order to select, but i'll find a way around that.
I already do everything else you describe.
The only problem that i see is that i am using wasd keys to move, so you would need to be not pressing movement keys in order to select, but i'll find a way around that.
Who is online
Users browsing this forum: No registered users and 2 guests