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

Computercraft Hotpotato Game

Started by Lewisk3, 09 November 2013 - 01:03 PM
Lewisk3 #1
Posted 09 November 2013 - 02:03 PM
–> Hot Potato Open Beta <–
Please Leave Any Suggestions
In the Comments :)/>

Download: http://pastebin.com/FJiAzyj3 - Now With Random Potato start
bonus : http://pastebin.com/C27XRJPk
infv-dev-Limitededition - bonus2: http://korbincraft.c...DITION_GAME.rar

Screenshots:
Spoiler
:
Edited on 10 November 2013 - 12:59 AM
Bomb Bloke #2
Posted 09 November 2013 - 08:52 PM
(For those wondering, it's a pong type game, A/D moves the paddle at the bottom to the left/right, and the paddle gets shorter with each life lost).

There's not much to see as-is, though I have a few recommendations:

Currently the potato's starting point is a bit predicatable. Most games play out the same as a result of this. It'd be worth looking into "math.random()".

If the potato hits a corner of the paddle, then it goes THROUGH the paddle. I'd expect it to rebound off in the opposite direction, or at least bounce.

You could start a short timer whenever the paddle moves. If the potato hits the paddle before this timer expires, then its direction may change accordingly. For example, if the potato is going right and hits the paddle just after the paddle itself moved right, then the potato might start moving two spots horizontally for every vertical movement.

This'd pave the way to adding targets to the arena, which the player would have to try to hit with the potato.
Lewisk3 #3
Posted 10 November 2013 - 01:37 AM
If the potato hits a corner of the paddle, then it goes THROUGH the paddle. I'd expect it to rebound off in the opposite direction, or at least bounce.
quote

thats going to take some time to perfect but think about then
if the potato hits the side of the paddle it would just bounce in a side-ways direction and get stuck bouncing back and forth forever
but i could switch it so the yvelocity is flipped but that would'nt be pysicly correct so i dont think there's a work arround this
let me know if u have a way to do this so its pysicly correct

Currently the potato's starting point is a bit predicatable. Most games play out the same as a result of this. It'd be worth looking into "math.random()".
will add that
Lewisk3 #4
Posted 10 November 2013 - 01:39 AM
You could start a short timer whenever the paddle moves. If the potato hits the paddle before this timer expires, then its direction may change accordingly. For example, if the potato is going right and hits the paddle just after the paddle itself moved right, then the potato might start moving two spots horizontally for every vertical movement.
This'd pave the way to adding targets to the arena, which the player would have to try to hit with the potato.

that sounds pretty confusing but if i added this wouldn't it be more idenical nirto's breakout game?
Edited on 10 November 2013 - 12:40 AM
Bomb Bloke #5
Posted 10 November 2013 - 03:00 AM
thats going to take some time to perfect but think about then
if the potato hits the side of the paddle it would just bounce in a side-ways direction and get stuck bouncing back and forth forever
but i could switch it so the yvelocity is flipped but that would'nt be pysicly correct so i dont think there's a work arround this
let me know if u have a way to do this so its pysicly correct
At the moment, when the potato has just moved directly above the "catcher" you reverse its vertical ("y") velocity.

I suggest instead performing a check just before the potato moves to see if it's going to go into the catcher, and if so, then reverse its vertical velocity. You can then (if you wish) have it also check to see if it's above the catcher, and if not, that means it struck right on the corner and you should reverse its horizontal ("x") velocity as well.

To prevent skilled players from exploiting this (by bouncing the potato into a screen corner over and over forever), you'd maybe make it random as to whether the catcher-corner rebound works or not (eg, check if math.random(2)==1 or some such thing).

will add that
That looks a bit better. Note though that "math.random(2,10)", for eg, should always return a number from 2 to 10: the "math.max" stuff wrapped around it isn't needed.

that sounds pretty confusing but if i added this wouldn't it be more idenical nirto's breakout game?
I've not played his particular version, but yes, it's a feature of most pong/paddlewars/breakout games.