This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Lewisk3's profile picture

Beams A Computercraft Game

Started by Lewisk3, 27 September 2013 - 04:31 PM
Lewisk3 #1
Posted 27 September 2013 - 06:31 PM
Beams v1.5.2

beams is a 8bit style game made by me

the objective is to: collect as many items as possible

and dont get hit by the beam

pretty simple yet fun game




Beams has been updated!

Now With Functional Beam Warning!

SpoilerInstallation:
on a advance computer do
mkdir Games
mkdir sprites
cd sprites
mkdir world

cd /
cd games
put the code from the first link is games directory
do cd /
cd sprites
cd world
rename the second links file to: bworld
place the file in sprites/world
cd /
cd Games
run beams
have fun :)/>
Booyaah #2
Posted 27 September 2013 - 08:52 PM
I played this for a little while and after reaching about 160 points I get an error "java.lang.ArrayIndexOutOfBoundsException"

Also you should make an installer for this so you can simply download 1 pastebin file instead of creating the directories manually.

How do I avoid the beams?? It looks like they are random and not possible to predict.
Booyaah #3
Posted 27 September 2013 - 09:25 PM
Wow, it didn't just error, It broke my advanced computer. After getting the "java.lang.ArrayIndexOutOfBoundsException: 256" my lua command line is broken. I type t=1 and it gives me the same out of bounds error and only rebooting fixes it.
Watch out for this program.
Lewisk3 #4
Posted 27 September 2013 - 10:15 PM
sorry i dont know how to fix java.jang error i think its in the mod itself sorry :(/>
i have been playing this and i have that same problem

if u want i have made a different game its a multiplayer game
i can post that instead

and i made a simple slot machine
i can also post that

I played this for a little while and after reaching about 160 points I get an error "java.lang.ArrayIndexOutOfBoundsException"

Also you should make an installer for this so you can simply download 1 pastebin file instead of creating the directories manually.

How do I avoid the beams?? It looks like they are random and not possible to predict.

i will update that ASAP
joshmanisdabomb #5
Posted 27 September 2013 - 10:21 PM
sorry i dont know how to fix java.jang error i think its in the mod itself sorry :(/>
i have been playing this and i have that same problem

A simple Google search would probably help you:
Thrown to indicate that an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array.

If you get an error when running your program, it's not ComputerCraft's fault. It's your fault. Fix it.
This game is really buggy and horrible to play.
  • The beams kill you instantly and it's completely random whether you get hit or not.
  • The random different coloured pixels don't seem to do anything, and serve no purpose but to be an eye-sore on top of the turd brown background colour.
  • This game looks like snake when you start moving, but it turns out it just seems to be a problem with the way things are drawn.
  • The player is drawn once after the game finishes.
I'm sorry, but it's just… terrible.
Lewisk3 #6
Posted 27 September 2013 - 10:26 PM
Wow, it didn't just error, It broke my advanced computer. After getting the "java.lang.ArrayIndexOutOfBoundsException: 256" my lua command line is broken. I type t=1 and it gives me the same out of bounds error and only rebooting fixes it.
Watch out for this program.

did u try save and quit the loading your world again?
nitrogenfingers #7
Posted 27 September 2013 - 10:31 PM
sorry i dont know how to fix java.jang error i think its in the mod itself sorry :(/>
i have been playing this and i have that same problem

I checked the code out for this one and found you're calling move() recursively. This is not an issue with the mod, this is an issue with your code, and if you keep playing it the computer will eventually crash.


The beams are also totally random so I'm not sure how to avoid them…
Lewisk3 #8
Posted 27 September 2013 - 10:46 PM
Beams Has Been updated sorry still havent fixed java problem yet
http://pastebin.com/0pZHj6VY

sorry i dont know how to fix java.jang error i think its in the mod itself sorry :(/>
i have been playing this and i have that same problem

A simple Google search would probably help you:
Thrown to indicate that an array has been accessed with an illegal index. The index is either negative or greater than or equal to the size of the array.

If you get an error when running your program, it's not ComputerCraft's fault. It's your fault. Fix it.
This game is really buggy and horrible to play.
  • The beams kill you instantly and it's completely random whether you get hit or not.
  • The random different coloured pixels don't seem to do anything, and serve no purpose but to be an eye-sore on top of the turd brown background colour.
  • This game looks like snake when you start moving, but it turns out it just seems to be a problem with the way things are drawn.
  • The player is drawn once after the game finishes.
I'm sorry, but it's just… terrible.

sorry i dont know java i only know LUA and vbs and html

http://pastebin.com/Qzc9W1Nd
Fixed Java.lang!

OK thank for the feedback i think i fixed almost all your problems try re installing it
i will soon make an installer

I know nitrofingers games are way way way way better than mine but i have just started makeing games
i used to make file managers but i decided to try something different

i have no experience makeing installers but i did my best: http://pastebin.com/rYZdJSjf

sorry i dont know how to fix java.jang error i think its in the mod itself sorry :(/>
i have been playing this and i have that same problem

I checked the code out for this one and found you're calling move() recursively. This is not an issue with the mod, this is an issue with your code, and if you keep playing it the computer will eventually crash.


The beams are also totally random so I'm not sure how to avoid them…

Thanks nitro. i fixed that also could u please review my game and filemanager on youtube it would mean alot to me :)/>
Booyaah #9
Posted 28 September 2013 - 04:05 AM
You should be testing your code before posting it. I can see other people aren't impressed but it seems like you want to improve so I want to help you.

The light blue background color is much better and you have fixed the java error.

The installer doesn't work though. You don't need the full URL for pastebin, you only need the code after 'get'. The following code works although it could be better by not using shell.run.


fs.makeDir("Games")
fs.makeDir("sprites")
shell.run("cd Games")
shell.run("pastebin get 4fJWWART beams")
shell.run("cd /")
shell.run("cd sprites")
fs.makeDir("sprites/world")
shell.run("cd world")
shell.run("pastebin get f8UWe4gh bworld")

The biggest problem is that there is still no way to avoid the beams. You need to allow the player to move while the warning is displayed rather than disabling movement. Also the text warning is not useful- try a graphical warning instead. A red background '>' in column #1 would be much more informative.
Lewisk3 #10
Posted 28 September 2013 - 04:10 PM
You should be testing your code before posting it. I can see other people aren't impressed but it seems like you want to improve so I want to help you.

The light blue background color is much better and you have fixed the java error.

The installer doesn't work though. You don't need the full URL for pastebin, you only need the code after 'get'. The following code works although it could be better by not using shell.run.


fs.makeDir("Games")
fs.makeDir("sprites")
shell.run("cd Games")
shell.run("pastebin get 4fJWWART beams")
shell.run("cd /")
shell.run("cd sprites")
fs.makeDir("sprites/world")
shell.run("cd world")
shell.run("pastebin get f8UWe4gh bworld")

The biggest problem is that there is still no way to avoid the beams. You need to allow the player to move while the warning is displayed rather than disabling movement. Also the text warning is not useful- try a graphical warning instead. A red background '>' in column #1 would be much more informative.


i can't figure out how to make the computer sleep but make it so u still can move any ideas?

sorry i dont know how to fix java.jang error i think its in the mod itself sorry :(/>
i have been playing this and i have that same problem

I checked the code out for this one and found you're calling move() recursively. This is not an issue with the mod, this is an issue with your code, and if you keep playing it the computer will eventually crash.


The beams are also totally random so I'm not sure how to avoid them…

how do i make it so when the warning for the beam come up i can still move?
H4X0RZ #11
Posted 28 September 2013 - 06:23 PM
Make the warning and the movement in a parallel.
like this(mixture of pseudo and real code):

local function warning()
  while true du
    if user has to be warned then
      warn the user
    else
      sleep(0)
    end
  end
end

local function movement()
  while true do
    if key has pressed then
      perform movement
    else
      sleep(0)
    end
  end
end

parallel.waitForAny(warning,movement)
I hope I've helped you :)/>/>/>
MudkipTheEpic #12
Posted 28 September 2013 - 08:06 PM
Make the warning and the movement in a parallel.
like this(mixture of pseudo and real code):

local function warning()
  while true du
    if user has to be warned then
      warn the user
    else
      sleep(0)
    end
  end
end

local function movement()
  while true do
    if key has pressed then
      perform movement
    else
      sleep(0)
    end
  end
end

parallel.waitForAny(warning,movement)
I hope I've helped you :)/>/>/>/>/>/>

What's while true du?

Also, it would be much more effecient if warning was structured without a loop, or maybe have it wait for a "warning" event, which is queued when a warning is needed.

movement should do the same thing, just waiting for a key event.

A full example would be like this:


function warning()
while true do
local event, message=os.pullEvent("warning") --Warning would have to be queued somewhere. 
--do something with the message
end
end

function movement()
while true do
local event,key=os.pullEvent("key")
--do stuff with key
end
end

parallel.waitForAny(warning,movement)

TL;DR: Event handling is better then polling here.
Lewisk3 #13
Posted 28 September 2013 - 08:10 PM
I figured it out beams now has everything everyone recommended!
Download the new version and tell me if u like it or not :)/>