Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % ENGR 1181 SDP Graphics Preview - Math Jumper
- %% Initialization: Setup the Scene and Sprites
- spriteSize = 16;
- zoomFactor = 6;
- bgColor = [180 220 255]; % Very Light Sky Blue background
- % Load the simpleGameEngine
- gameScene = simpleGameEngine('Tiles.png', spriteSize, spriteSize, zoomFactor, bgColor);
- % Define Sprite Indices (AESTHETICS FIX: Using brighter/plain tiles)
- IDX_BACKGROUND = 65; % FIX: Lightest plain tile available (near the water)
- IDX_GROUND = 3; % Busy ground tile for the very bottom layer
- IDX_PLATFORM = 26; % The wooden plank bridge/platform
- IDX_CHARACTER = 85; % The small mushroom/red object (Jumper)
- IDX_START_BTN = 79; % The small chest/crate (Button)
- IDX_QUESTION_BOX = 77; % The large, dark wooden chest (Question Frame)
- % Define the Scene Size
- ROWS = 10;
- COLS = 15;
- ---
- %% Scene 1: Start Screen/Instructions (drawScene #1)
- scene1_matrix = IDX_BACKGROUND * ones(ROWS, COLS);
- scene1_matrix(ROWS, :) = IDX_GROUND; % Only the bottom row is the busy ground
- scene1_matrix(ROWS-1, 7) = IDX_CHARACTER;
- scene1_matrix(ROWS-3, 7) = IDX_START_BTN;
- drawScene(gameScene, scene1_matrix);
- % Add Annotation Notes
- title('Scene 1: Main Menu - Press Start to Begin Math Jumper!');
- text(1, 1, 'Note: Features the Start Button (small chest) and the Player (red mushroom).', 'FontSize', 12, 'Color', 'k');
- % FIX: Turn off annotations after screenshot (to "get rid of the note")
- pause(0.5);
- set(gca, 'Visible', 'off');
- % Use Keyboard Input for Transition 1
- fprintf('*** Scene 1 Displayed. Press ANY KEY to view Scene 2. ***\n');
- getKeyboardInput(gameScene);
- ---
- %% Scene 2: Gameplay - Active Jump Sequence (drawScene #2)
- set(gca, 'Visible', 'on'); % Re-enable axis for new annotations
- scene2_matrix = IDX_BACKGROUND * ones(ROWS, COLS);
- scene2_matrix(ROWS, :) = IDX_GROUND;
- % Place platforms
- scene2_matrix(ROWS-2, 3:6) = IDX_PLATFORM;
- scene2_matrix(ROWS-4, 8:11) = IDX_PLATFORM;
- scene2_matrix(ROWS-6, 1:4) = IDX_PLATFORM;
- % Place the character
- scene2_matrix(ROWS-5, 9) = IDX_CHARACTER;
- drawScene(gameScene, scene2_matrix);
- % Add Annotation Notes
- title('Scene 2: Active Jump Sequence - Score: 3 Jumps');
- text(2, 1, 'Note: Player is mid-jump progression, showing dynamic platforms.', 'FontSize', 12, 'Color', 'k');
- text(8, 1, 'Score and Lives are tracked (implied text overlay).', 'FontSize', 12, 'Color', 'k');
- % FIX: Turn off annotations after screenshot
- pause(0.5);
- set(gca, 'Visible', 'off');
- % Use Keyboard Input for Transition 2
- fprintf('*** Scene 2 Displayed. Press ANY KEY to view Scene 3. ***\n');
- getKeyboardInput(gameScene);
- ---
- %% Scene 3: Gameplay - Math Problem Pop-up (drawScene #3)
- set(gca, 'Visible', 'on');
- scene3_matrix = scene2_matrix;
- scene3_matrix(3:7, 5:10) = IDX_QUESTION_BOX;
- drawScene(gameScene, scene3_matrix);
- % Add Annotation Notes
- title('Scene 3: Math Problem Pop-up - Solve to Continue!');
- text(1, 1, 'Note: Large central chest/box frames the math question (9 + 4 = ?).', 'FontSize', 12, 'Color', 'k');
- text(7, 12, 'A countdown timer (implied text) pressures the player to answer quickly.', 'FontSize', 12, 'Color', 'k');
- xlabel('Press any key to close the program.');
- % Final Cleanup
- pause(0.5);
- set(gca, 'Visible', 'off');
- getKeyboardInput(gameScene);
- close(gameScene.my_figure);
Advertisement