Best way to attach paddles to each other?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
kristinamay
Prole
Posts: 3
Joined: Sat Nov 12, 2022 6:15 pm
Contact:

Best way to attach paddles to each other?

Post by kristinamay »

I'm working on a pong variant that makes the paddles add a layer when the player scores. The paddle detection is working perfectly for the first "layer", but on subsequent layers, the new shapes/fixtures don't seem to be working to detect collision like the first ones. My theory is that this has to do with how the new shape and fixture interact with the base body, but I can't for the life of me troubleshoot my way out of this one.

I initially looked into weldJoints for this, but it seemed overkill when what I really need is to just effectively increase the width of the paddle and slap on a second fixture (I think?).

https://github.com/kristinalustig/pongburger Here's my code (the relevant stuff is in physics.lua, namely in beginContact() and startNewRound() (as well as in createPaddleObject()). I also included the latest build in dist/0.0.2 if you want to see the issue I've described for yourself. W/S are up + down for left paddle, Up + Down for right.

Thank you so much for your help - I've made several games in love2d thus far but this is my first one even partially using the physics engine so I'm a bit out of my depth. This lovely community has made my dream of making indie games a reality <3
User avatar
kristinamay
Prole
Posts: 3
Joined: Sat Nov 12, 2022 6:15 pm
Contact:

Re: Best way to attach paddles to each other?

Post by kristinamay »

Update - I actually think it sort of works, just only on paddles past paddle # 1 for some reason. :-O
User avatar
togFox
Party member
Posts: 764
Joined: Sat Jan 30, 2021 9:46 am
Location: Brisbane, Oztralia

Re: Best way to attach paddles to each other?

Post by togFox »

Assuming you're using physics engine you could destroy the paddle and instantly create one with a different size or you can check my last game. It has a physics space ship that grows over time.

https://github.com/togfoxy/Asteroids/tree/master/Source

I'll try to find the bit for you.

Edit: I'm on mobile so can't do much but point you to my functions.lua which destroys and recreates a larger ship in its place.
Current project:
https://togfox.itch.io/backyard-gridiron-manager
American football manager/sim game - build and manage a roster and win season after season
Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests