Hello Readers, Welcome to Coding by Learning !!! 😀 In this tutorial, we look at the code which creates a "Smiley Crush Game" similar to Candy Crush in Python language. Here You Go !! import pygame import random # --- Game Setup --- pygame.init() WIDTH, HEIGHT = 600 , 650 # extra space for score/moves ROWS, COLS = 8 , 8 CANDY_SIZE = WIDTH // COLS FPS = 60 screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption( "Smiley Crush" ) # Fonts for text & smileys font = pygame.font.SysFont( "Arial" , 28 ) emoji_font = pygame.font.SysFont( "Segoe UI Emoji" , 48 ) # Emoji-friendly font # Smiley icons (candies) smileys = [ "😀" , "😂" , "😍" , "😎" , "😡" , "🤢" ] # Create board board = [[random.choice(smileys) for _ in range (COLS)] for _ in range (ROWS)] # Score and moves score = 0 moves = 0 # --- Load Sounds (replace with your own .wav or .ogg fi...
Hello Readers, Welcome to Coding by Learning !!! 😀 6. What is data type? As name says it defines type of data the value holds that can be stored in to variable 7. What are different data types available in VBA? VBA has multiple data types in order to handle data for the programming. Some of the major data types which often be used are: integer, single, long, double, range, date, variant, object 8. What is Variant data type? Variant is the special data type which can accept any type of data. Variable which is declared as variant will get data type based on the value it is assigned 9. How to declare a variable in VBA? Using Dim keyword variable will be declared in VBA. Syntax is : Dim VariableName As Datatype 10. Is it possible to declare a variable without data type in VBA? If yes, What data type it holds? It is possible. If developer declares a variable without mentioned any data type then it will be considered as variant data type. Happy learning & ...
Hello Readers, Welcome to Coding by Learning !!! 😀 1. What is VBA? VBA stands for Visual basic for application. 2. Who developed VBA? VBA is created my Microsoft developers team. 3. Where developer can write VBA code? All office based application has in-built with VBA editor. Developer needs to write their code in the editor. How to access VBA code editor/IDE Way1 We can access it using keyboard short cut Alt+F11. Way2 Navigate File -> Options -> Customize Ribbon -> click on the check box next “Developer” under Main tabs - > Ok Go to Developer Menu and click on Visual Basic 4. What is basic object model of excel application? Application -> Workbook -> Worksheet -> Range/Charts 5. What is option explicit? Option explicit making declaration of variables mandatory. For more details refer my blog link : Option Explicit Happy learning & Happy coding!!! Comment and share this post to your friends and colleagues 😀
Comments
Post a Comment