Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Clash of : wall

Author
Message
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 17th Mar 2017 17:50
Hi

Do you know How I can check if a wall is near another wall to change the sprite of this wall, like in game like : clash of clan, clash of lords, castle clash...



For example, in this image, how can I know that the first and second block (from the bottom) have to be changed to another block (a kind of wall) ?

If you have an idea how to do that, it will be great
thanks
AGK2 tier1 - http://www.dracaena-studio.com
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Mar 2017 22:03
Do you mean that the three block must merge to become one wall? (Or replace the three block objects with one object that is three blocks wide)
nickele upgraded
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location: Birthplace of Democracy
Posted: 17th Mar 2017 23:06
Maybe you can use a 2 dimensional array or, better, a memblock to store values that represent the types of units/sprites on the surface (assuming that this isometric view represents a 2d surface).
It's up to you then to make the checks and decide which sprite can be changed or positioned somewhere.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Mar 2017 23:14
Yes a 2d array would work. I would search match 3 algorithms too
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 18th Mar 2017 18:14
Hi

thank you for your comments.
I have tried this technic and it works fine :



In the main code, i use (after a mousereleased) :


And the result in my test :
AGK2 tier1 - http://www.dracaena-studio.com

Login to post a reply

Server time is: 2024-03-28 10:45:06
Your offset time is: 2024-03-28 10:45:06