Jump to content
  • Advertisement

Just gotta switch it up a bit!

CyberFlash

581 views

For some reason yesterday afternoon I had a "Nothing is going to work" moment and it turns out that was unnecessary because it worked in the end... I'm talking about clicking a tower and then deactivating that click if you click something else... 

unknown.png?width=807&height=676

Menu is currently undergoing some surgery ;) One tiny little detail I had not noticed until last night (with Bloons Tower Defense 3 -- My chosen example for tower clicking) is that its literally anywhere beyond a certain point on the x, the click on/off stops working... This means you can freely click around your menu and noone cares :P Towers won't turn off BUT then if you were to click a new Tower and bring that into play, the radius of the existing tower still is switched on... 

I managed to turn that off too by just quicking making a global.picked = false; variable (I forgot the name for these.... A bool? Basically a on/off, true/false thingy.. and then I'd turn it on when another tower is 'picked' which is what I'm using to draw the tower around my mouse and then turn it back off when you've placed the tower -- which then triggers the click of the tower which then triggers my upgrade display system.... It feels like such a simple thing I feel like I blew it out of focus and just panicked about it 🤣for no reason......

But, I did learn of a cool method called 'switch statements' which seem cool and tidy.. It just completely threw me off when I was trying to use them as I got "Case Argument Should Be A Constant" and someone even stopped by my stream just at that point in time and said "pretty sure you can't use a case like that" so I was doing something wrong... I managed to figure it out and get it working with IF IF and IF stuff... So basically 3 conditional if checks before it does my thing... Is this where I should use a switch... This basically means 3 conditions need to be met before the action happens. The action would be "turning on the light switch" (activating my bool) like I can handle the action part its just the trigger part.. So I bookmarked me a video about Switch Statements in Game Maker Studio that I should watch at some point through this week.

unknown.png?width=807&height=676

The other thing I've added is the radar will be red if you cannot place the tower (to help guide you as there isn't any instructions that say "Can't place here" "Can place here" kinda thing... I also actually had to resize the canvas of the tower objects because this seems to be a thing I forget... I'll get the sprite to be the 'correct' size based on my preference or whatever I dunno.. I basically scale and figure it out BUT then I forget that I'm using a 64 x 64 grid and I've got it so when you place a tower it'll snap to the grid too... only IF nothing else is there... So technically there was a tower on a cell but the range would show you could place there when you can't.. Even if you try to place, you can't :P  and would you believe it? The solution to that was that I didn't resize my sprite canvas' after sizing them... So sprites stayed same size with same origin point and all that good stuff but now I can do a proper bounding box around the 'cell' BINGO!!

I think I still want to say I'm really enjoying this... I mean I'm taking a project further than ever before in the sense that I got it working and now its all about the improvements, upgrades, updates etc whereas previously I'd get a placeholder prototype done and nobody would wanna do anything and so i'd stop too.. I dunno, it was a motivation thing really I guess. I'd use free assets to build 'something' and then just dislike it more n more by the day because it didn't look 'cool' or 'fresh' or whatever but now I luckily managed to find a arty person and its looking good! I think so anyway. (Ignore current menu... legit next previews/version will have a dope menu -- it was finished last night after my stream and so it hasn't been applied yet..) 

OH yeah this one is just one for the funnies:

unknown.png?width=807&height=676

When you forget to put the walls back in :P:P .... (I used a wall object to block paths and then only allow placement in 'nothing' is there already)




0 Comments


Recommended Comments

Heck yeah man!  Glad to see it progressing!  Looking really good!  The more you learn, the less frustrating and the more fun everything becomes! :D

Share this comment


Link to comment

I am 10000% determined that I'm guna use a Switch statement somewhere in this just for the learning of it at least :P 

I'm also like 2 steps away from functioning upgrade system and selling towers system... 

But yeah, for sure. As I'm understanding more and more, its definitely less annoying :P 

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!