Making a Prototype - Godot Card Game #4

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right welcome to adventures in game development we are continuing work on our card game prototype uh where we ended up last time is uh with the ability to select and play a card and then the opponent will randomly select a card from their hand and play it on a random slot we're keeping track of the score which is just the sum of all the numbers so it's not the most engaging game at the moment um because when you go first you have a huge advantage even though here i lost but it's all random right now just whatever score is highest the end wins um so this video i think first up let's do like a coin flip to see who goes first so it's not always the player that goes first and then uh we'll try to implement some abilities on cards so like when you play a card it will do something perhaps damage another card and um or at the end of the turn it it'll do something so cards will not only have a number associated with them they'll have a set of abilities that kind of happen and then the rules of the game are the same like at the end whatever the score is that will determine the winner so uh with that uh let's go okay so first up i think the easy thing to do is uh instead of having player turn always be true we're calling randomize so we can just have player turn is equal to um rant i one oh no no no no randy two equals zero so uh so if it's false we do need to we can set this at the end here we can even set it after update score so it can be the last thing that happens player turn that and then if not player turn we gotta do opponent otherwise nothing is gonna kick off that the opponent needs to take a turn and if it's not uh if player turn is true so it's the player's turn this it will will handle the input events normally so uh it should be my turn here can tell because i can hover over great uh hover over the cards and they'll scale like if it's not my turn there is no hovering um okay so we went first that time there we go and the opponent goes first sweet we want to update our card class right now it's just taking the label how do i get the actual like scene there we go it's just taking the label and setting it to a random value but i think we know that each car is going to have like a base value uh it'll have a current value as i imagine they will be changing over time it uh needs to keep track of who's owning it so one thing if you've played triple triads before you know anything about that the cards like flip so if it's blue and it gets captured in some way it'll flip to a red and vice versa and so that's a way to kind of like change the uh uh like i imagine that there might be a scenarios where if you damage a card and it goes below zero we'll want to flip it so let's just have it be a boolean that says who owns it and then abilities and this is a dictionary because each ability is going to have say a name and then some value or at least a few of the abilities that i can think of i think that's a decent way to structure it then based on those we're going to have a update like a function that updates update state okay so then the label let's rename this actually so this is going to be the value label and then there's also going to need to be a abilities label or effects label what did i call it uh script abilities okay so node label and we'll call this abilities label okay so value it's gonna be that and then this will be like a comma separated list of the abilities abilities string is that for now and then for ability in abilities ability string plus equals ability plus and then just do a new line for now oh this needs to be far ah that var is gonna get me label dot text equals ability string and then we'll do the color in here too so right now looks like get node background modulate so we should just be able to do assign background dot modulate which still a weird thing for me it's still a weird like name for the color why why isn't it just called color play around there might wonder if there's a way to do this in a single line like in c sharp and java you do the question mark syntax um there's probably a way to do that but maybe not um if there is let me know okay so if it's player owned do we want to be blue otherwise okay so then we'll call update state in our card game okay it looks like ready is called whenever it's instantiated in the scene or added to the scene and all of its children are also instantiated which is not something we have to worry about but uh it does mean that i should be able to set all the properties that i care about before i call add child what are these ones these are true and then this one say player owned is false then when the card is instantiated after this is set then it should hopefully call update state and set it to the correct color i kind of want to set the base value outside as well and then same thing with the abilities so the only thing that should happen is current value gets set to the base value and the card is instantiated and then we update our state which will set all the widgets this is just going to be card dot current value and then we don't need that anymore because we can just do cards dot player owned okay and they all have test one which is great it's my turn cool okay so basically we haven't really done anything other than just shuffle around where the data is getting set uh and who is managing what but now we want it to actually do something so let's the the most kind of naive implementation of an ability that i can think of let's call it attack and this is ability that when the card is played it does one damage um for lack of a better word to all adjacent cards of the opposite type so i think we're going to want a method that is play card that basically checks that um and uh will handle all the abilities that happen on the play card trigger sure we'll set this scale here too um damage is var damage bar damage is car diabetes attack okay so this should this is going to iterate over all the adjacent ones but we don't want diagonal adjacent ones so just if i is equal to pose dot pose.x or oh or forget i don't need parentheses or j is equal to pose dot y okay so that should only get the horizontal and vertical adjacent positions here all right we're getting this is getting nested pretty deep but uh there's probably a more elegant way to do that but let's just make sure this this all works first and then maybe we can optimize that up target dot current value minus equals damage and then target dot update what did i call it just update state so let's see what the hell happens i'm not sure what to expect here oh not position is card that's why okay my turn seven dope okay sorry that's the position index let's okay slot index and then the position is not that board slots slot index oh it is a 2d list so it's board slots i jet that's what it is nine okay okay so that didn't work the min value was clamping it at two on the top but but the index needs to be zero one and two so the min needs to be three and then our uh top part of these ranges need to be whatever the current slot index is plus two also so now that that's working uh when i play here damages it and it updates the score playing damages here so zero i think what i want to do on zero is flip the card and reset its uh current value back to its base value okay so that'll make anything that gets destroyed flip um so just to make the likelihood of that let's make base value between one and two just so i can have a lot of ones okay so so that should go to one and eventually we'll play a one oh i could have okay so this should flip that nice uh let's just implement one more ability here on the play ability i thought i had was just to there's like a regular attack and then there's like a ranged attack so um let's just call it ranged so ranged is just gonna do that much damage to all cart regardless of where they are they don't have to be adjacent so we just need to iterate basically the same thing here but we're going to iterate just from a range of three and range of three so i think all my cards should have ranged there's have attack so if i play over here it should damage it nice and if i play this it'll damage both yeah ranged is a good ability damage all of them and then i should have been playing my eight i don't know my eight of my nine but this will deal four damage and then he'll win with that well i think that that's gonna do it for this one that was pretty successful uh uh work here got that done pretty quickly um i'll have to spend a little bit of time and think about some a some other abilities uh i definitely do want to have different kinds of triggers you know when cards enter the you know when you play a card or like i mentioned before at the end of the turn or at the beginning of the turn i got to think about when a card flips do i want its abilities to activate again probably not there are other like passive abilities i can think of like a shield or something so that like the first time it's attacked in some way it just cancels out um or that that attack doesn't do anything um and then we can work on the ai too and get it to not just play in random positions have it actually try to calculate out what it thinks will be best anyway plenty of stuff to uh keep uh rolling with this prototype and flesh it out a little bit more so thanks for sticking with me so far peace
Info
Channel: Gabe's Game Dev
Views: 158
Rating: undefined out of 5
Keywords: Indie Game Dev, Devlog, Godot Engine, Game Development
Id: C0CMCDf2GgY
Channel Id: undefined
Length: 15min 45sec (945 seconds)
Published: Tue Sep 21 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.