Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
my third game, simple arkanoid
(03-18-2024, 01:00 AM)1micha.elok Wrote:
(03-17-2024, 03:24 PM)aliensoldier Wrote: I share with you a simplified version of arkanoid...

Your arkanoid is "rompe-ladriollos del mundo"  
note : Is it correct to say "brick breaker of the world" in Spanish ?  Big Grin

Yeah that's right. Smile "rompe-ladrillo del mundo"

(03-18-2024, 06:19 PM)Marcus Wrote: Very nice, very retro Smile

It's kind of hard to get the ball where you want it, lots of waiting. Nothing wrong with that. If I rememeber correctly, that's the way it worked in the good old days too! But I've modified your collision_ball function (player.n7) so that it's possible to aim a little.

If the ball bounces on the left part of the paddle, the ball goes left. The more left on the paddle, the more left it goes. Same thing with the right side. If the ball hits the absolute center of the paddle, the ball goes straight up. That's how I usually make the controls for breakout games.

I don't think it's the "spin" thing you asked for, because I didn't quite understand what you meant.

    player.collision_ball = function()
        if collision_rect(this.x,this.y,this.Width,this.Height,this.ball.x,this.ball.y+this.ball.velocity_y,this.ball.Width,this.ball.Height)
            play sound sound_bounce,0.7
            ' Marcus.
            'this.ball.velocity_y = abs(this.ball.velocity_y)
            ' Calculate the current speed.
            speed = sqr(this.ball.velocity_x^2 + this.ball.velocity_y^2)
            ' Distance in x from ball center to paddle center, dx will be ~[-0.5..0.5].
            dx = (this.ball.x + this.ball.Width/2 - (this.x + this.Width/2))/this.Width
            ' set dy to -0.4, so that you get a good range of possible bounces. You can
            ' experiment with different values. Lower values mean wider range of angles, it should
            ' be less than 0.5 though.
            dy = -0.4
            ' Create new velocities by normalizing (dx dy). That is, recalculate the length of
            ' (dx dy) so that it is 1 but still points in the exact same direction.
            k = 1/sqr(dx*dx + dy*dy)
            dx = k*dx
            dy = k*dy
            ' Now multiply dx and dy with speed, so that the speed of the ball doesn't change from
            ' what it was before.
            dx = dx*speed
            dy = dy*speed
            ' Set ball velocity (while testing this I noticed that the ball is moving with its
            ' negative direction, which made me confused :) ).
            this.ball.velocity_x = -dx
            this.ball.velocity_y = -dy
The translator translates in his own way. Sad

I have noticed a problem with your code, while playing it happened that the ball got stuck on the right side of the screen.

I'll give you a video of the Super Nintendo game Arkanoid in case you want to play this game a little on the emulator and check what I say about handling the direction of the ball.

(03-17-2024, 05:42 PM)johnno56 Wrote: Nicely done! Those multi-hit bricks gave the ball a work out.... Good job!

I have to think of a way to increase the difficulty in the games I'm making because they're too easy. Confused

Messages In This Thread
my third game, simple arkanoid - by aliensoldier - 03-17-2024, 03:24 PM
RE: my third game, simple arkanoid - by johnno56 - 03-17-2024, 05:42 PM
RE: my third game, simple arkanoid - by aliensoldier - 03-18-2024, 07:07 PM
RE: my third game, simple arkanoid - by Marcus - 03-18-2024, 06:19 PM
RE: my third game, simple arkanoid - by johnno56 - 03-18-2024, 10:22 PM

Forum Jump:

Users browsing this thread: 1 Guest(s)