How to spawn tokens at a specific x or y

Game development with Board Game Arena Studio
Post Reply
gamemaker0
Posts: 2
Joined: 05 November 2024, 06:07

How to spawn tokens at a specific x or y

Post by gamemaker0 »

I am trying to make a game of connect 4 and would like to have the tokens slide down the board as they would in real life, but for right now they just spawn at a random spot at the top of the board and moves to their designated location. I am using the Reversi tutorial code as the base if that helps.
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: How to spawn tokens at a specific x or y

Post by RicardoRix »

https://en.doc.boardgamearena.com/Game_ ... Animations

slideToObjectPosition() might be what you need.
User avatar
KuWizard
Posts: 337
Joined: 24 May 2018, 14:10

Re: How to spawn tokens at a specific x or y

Post by KuWizard »

RicardoRix wrote: 09 February 2025, 11:50 slideToObjectPosition() might be what you need.
As far as I can see, slideToObjectPos() just uses x and y to offset the sliding object from the target object location.
I would suggest to create a fake invisible element whenever it is needed to start the animation and slide the object from it to a needed position
User avatar
RicardoRix
Posts: 2548
Joined: 29 April 2012, 23:43

Re: How to spawn tokens at a specific x or y

Post by RicardoRix »

KuWizard wrote: 09 February 2025, 17:57
RicardoRix wrote: 09 February 2025, 11:50 slideToObjectPosition() might be what you need.
As far as I can see, slideToObjectPos() just uses x and y to offset the sliding object from the target object location.
I would suggest to create a fake invisible element whenever it is needed to start the animation and slide the object from it to a needed position
fastidious much..

He doesn't actually provide the exact code. I linked the document with all the details.
gamemaker0
Posts: 2
Joined: 05 November 2024, 06:07

Re: How to spawn tokens at a specific x or y

Post by gamemaker0 »

Alright, so with the help of my classmates I was able to use one of the per-existing divs used to make the board and simply have the token spawn at the same x as the final destination with the y being set to 1. Thank you both for the advice as it did help with understanding how the function worked,and thank you RicardoRix for providing me the link to the animations document, I intend on learning more about animations to make the game look better.
Post Reply

Return to “Developers”