Making a Prototype - Godot Card Game #2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right welcome back to adventures in game development we're going to be continuing work on our card game prototype using the godot engine uh it's later in the evening i've got a logger and uh we're ready to go here i think gonna try to get um some basic input uh in place here so being able to select cards and place them on the board and then if we get to it we'll implement some really basic logic uh the the game logic so uh without further ado let's uh let's go okay so it looks like we need to do something with this input event or this is a way to do it i am putting it directly on the card node it's possible it's going to need to be on the sprite but uh we'll just see if the card node itself basically has like a bounding area for its children i have a feeling this is not gonna work but uh we'll give it a shot here i think i can do dollar sign bg dot get wrecked ah okay i see we just got to get the local mouse position of our sprite 2 and that's cool we can call it from our apparent thing here or i think that that's let's test it out so if we do the card game again should have nothing over here but then a on card on card on card on card's sake okay so now i think we're going to just as a test or just so i can figure out how to do it when we hover over a card just make it scale up a little bit um let's give that a shot okay so we're gonna print out the label text here just to make sure that where it's only being fired on the card that um the mouse is actually hovered so if they're stacked in the tree uh that this event won't propagate to um anything else so let's just test this out so it should only be six here and then it should switch to one only cool and then four two awesome all right so looks like each node just has a scale property we can set the scale to 1.2 if we're hovered over it uh handle that input otherwise uh scale is always going to be one so that's kind of interesting okay so it works when i go over and off over and off but when i go here and then this the hover on this one handles the event so this one's not receiving any events ah i think that that's what's happening all right so what i think i actually want to do i don't necessarily want this to be a property of the card itself because i don't know if that's necessarily how i want the behavior if i'm uh displaying a card in another scene so i'm gonna move this to the card game and uh we're going to uh iterate over all of our cards let's just do it only over the the player cards card get note background get rekt has the point and we want it in our card get mode background local position oh i don't want i want card scale of course it's kind of funny it should have scaled the whole scene but i mean let's see if that does it yeah hey okay but i'm still now i'm still getting now i can't use this input handled it doesn't that doesn't really even matter we can kind of hack it where we iterate over the cards and reverse because all the cards are in order from lowest in depth and as soon as one of the cards meets this if statement we set all the others i mean this is kind of a hack but let's just try it if we haven't found anything and it's the first card that it finds it's going to scale it i feel like logically this should work uh just crashed invalid index five because we're iterating from size we need to go from size minus one to negative one minus one ah hey look at that all right and then nothing on the perfect all right next we're going to do instead of just uh hovering over it scaling it we'll do like a little mini scale when you hover it but then when you click on it it'll be like selected and it will scale even more and it will stay selected until you select something else so let's work on the logic for that let's do this to simplify our here card background not direct because card background is the thing that we do that and dot get direct okay button index invalid index button underscore index is not a thing because maybe some events are happening that aren't yeah they're hovered events yeah yeah yeah yeah and so there is no button index on a hovered event makes sense okay type is not a thing anymore okay so that's how we check if the event is a button one then hopefully it'll have a button index and can be pressed otherwise if it's not a button then just use the regular yeah okay so that's our hover and then if i click it'll stay click stay cool um let's adjust the scale on the this just the hover to be a little bit less and there we go hovers a little bit less select it so someone should let me know if this is not the best way to deal with input it seems like there is a way to do like in the actual just process method you do capital i input dot get event or something like that um and perhaps that's would be a better way to do this like i don't know if scaling um objects in this input loop i mean i think clearly it's just at a different stage like the input is going to happen before or after all the update or process methods are called so and i assume it's all rendered at the end of all that so it probably doesn't have any consequences other than this code is always going to get called before all the code in any of the process methods uh but i don't know maybe it's bad form to do this so i suppose if you know anything about godot uh enlighten me please the next thing to do is when i click here i want to click one of the slots and it will put the card in the slot okay so let's store our board slots as well i gotta figure out how to do multi-line if statements maybe i just do it like this it doesn't like that error colon expect is it like python where i can just dash it hey that does work sweet selected player card um dot position equal to board slot position and then selected player card scale two one one and then selected player card dot is equal to null and then we can figure out logic of stuff boom boom okay but at least now we can play our cards and then it'll go my turn their opponent's turn etc all right uh it's starting to get a little late tonight so i think i'm gonna call it for now learned a little bit about godot and how the input system worked that was great how to kind of scale and move things around and our prototype is to the point where we can hover over our cards and then select them to play i got to figure out how where this artifacting is happening when we scale or why it's happening how to get rid of that because that's pretty that's a mess um and we can just put our cards on the the board and then next time i think we'll get to i play a card and then the opponent's gonna play a card and then we'll just kind of go back and forth and then keep track of the score um so we'll keep fleshing it out next time uh anyway thanks for watching and uh peace
Info
Channel: Gabe's Game Dev
Views: 387
Rating: undefined out of 5
Keywords: Godot Game Engine, Card Game, Game Dev log, devlog, Godot Dev Log, Indie Game Dev, Game Development
Id: uvcUpzxY758
Channel Id: undefined
Length: 11min 3sec (663 seconds)
Published: Tue Sep 07 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.