▲ 5 r/pico8

trying to make a slash

so I'm currently working on an attack and want to make it so that even when I'm moving I am slashing the sword in any key I'm holding in and should rotate in that key because I'm not making a sprite for each direction, here's my attack code:

--attack

--attack variables
atck_strength = 5
atck_dur = 4
is_atck = false
atck_swing_anim_timer = 0
atck_delay = 2

function attack_init()
atckposx = 63
atckposy = 63
end

function attack_update()

 if btnp(🅾️) then
  is_atck = true
  atck_swing_anim_timer = atck_dur
 end

 if atck_swing_anim_timer > 0 then
  atck_swing_anim_timer -= 1
 else
  is_atck = false
 end

end

function attack_draw()

if is_atck then
spr(001, atckposx, atckposy)
end

end
reddit.com
u/prasan4849 — 1 day ago
▲ 3 r/pico8

how to make a dash

I'm struggling on making a dash, I've tried everything but they just broke the game, here's my code:

--puppy killer

--by roastedbird

function _init()

--player variables

`posx = 0`

`posy = 0`

`speed = 1.5`

`dash_speed = 3`

`dash_dur = 8`

end

function _update()

--input

`if btn(➡️) then`

 `posx = posx + speed`

`end`



`if btn(⬅️) then`

 `posx = posx - speed`

`end`



`if btn(⬆️) then`

 `posy = posy - speed`

`end`



`if btn(⬇️) then`

 `posy = posy + speed`

`end`

end

function _draw()

`cls()`

`spr(0, posx, posy)`

end

reddit.com
u/prasan4849 — 4 days ago
▲ 10 r/raylib

How to compile my c game into an exe

So I just finished building a small game and want to compile it into an exe but I don't know how, also my friends don't have raylib installed. How do I do it?

reddit.com
u/prasan4849 — 21 days ago
▲ 6 r/raylib

I followed a tutorial and got this error, how do I fix it?

"> Setup required Environment

-------------------------------------

ENV_SET: PROJECT_NAME=function_testing

$(SYS.PROJECT_NAME) = function_testing

ENV_SET: RAYLIB_PATH=C:\raylib\raylib

$(SYS.RAYLIB_PATH) = C:\raylib\raylib

ENV_SET: PATH=C:\raylib\w64devkit\bin

$(SYS.PATH) = C:\raylib\w64devkit\bin

ENV_SET: CC=gcc

$(SYS.CC) = gcc

CD: C:\Users\prasa\OneDrive\Desktop\raylibcfuncitnos

Current directory: C:\Users\my_username\OneDrive\Desktop\raylibcfuncitnos

> Compile program

-----------------------

make

Process started (PID=16628) >>>

mingw32-make function_testing

make[1]: Entering directory 'C:/Users/my_username/OneDrive/Desktop/raylibcfuncitnos'

gcc -c functionpopuptest.c -o functionpopuptest.o -Wall -std=c99 -D_DEFAULT_SOURCE -Wno-missing-braces -Wno-unused-result -O2 -I. -IC:/raylib/raylib/src -IC:/raylib/raylib/src/external -DPLATFORM_DESKTOP

In file included from C:/raylib/w64devkit/include/windows.h:71,

from functionpopuptest.c:2:

C:/raylib/w64devkit/include/wingdi.h:3251:28: error: 'Rectangle' redeclared as different kind of symbol

3251 | WINGDIAPI WINBOOL WINAPI Rectangle(HDC hdc,int left,int top,int right,int bottom);

| ^~~~~~~~~

In file included from functionpopuptest.c:1:

C:/raylib/raylib/src/raylib.h:259:3: note: previous declaration of 'Rectangle' with type 'Rectangle'

259 | } Rectangle;

| ^~~~~~~~~

In file included from C:/raylib/w64devkit/include/windows.h:72:

C:/raylib/w64devkit/include/winuser.h:2282:29: error: conflicting types for 'CloseWindow'; have 'WINBOOL(struct HWND__ *)' {aka 'int(struct HWND__ *)'}

2282 | WINUSERAPI WINBOOL WINAPI CloseWindow (HWND hWnd);

| ^~~~~~~~~~~

C:/raylib/raylib/src/raylib.h:987:12: note: previous declaration of 'CloseWindow' with type 'void(void)'

987 | RLAPI void CloseWindow(void); // Close window and unload OpenGL context

| ^~~~~~~~~~~

C:/raylib/w64devkit/include/winuser.h:3761:25: error: conflicting types for 'ShowCursor'; have 'int(WINBOOL)' {aka 'int(int)'}

3761 | WINUSERAPI int WINAPI ShowCursor(WINBOOL bShow);

| ^~~~~~~~~~

C:/raylib/raylib/src/raylib.h:1037:12: note: previous declaration of 'ShowCursor' with type 'void(void)'

1037 | RLAPI void ShowCursor(void); // Shows cursor

| ^~~~~~~~~~

functionpopuptest.c: In function 'main':

functionpopuptest.c:33:22: error: passing argument 1 of 'DrawTextA' from incompatible pointer type [-Wincompatible-pointer-types]

33 | DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);

| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

| |

| char *

C:/raylib/w64devkit/include/winuser.h:3480:39: note: expected 'HDC' {aka 'struct HDC__ *'} but argument is of type 'char *'

3480 | WINUSERAPI int WINAPI DrawTextA(HDC hdc,LPCSTR lpchText,int cchText,LPRECT lprc,UINT format);

| ~~~~^~~

In file included from C:/raylib/w64devkit/include/minwindef.h:163,

from C:/raylib/w64devkit/include/windef.h:9,

from C:/raylib/w64devkit/include/windows.h:69:

C:/raylib/w64devkit/include/windef.h:47:1: note: 'HDC' declared here

47 | DECLARE_HANDLE(HDC);

| ^~~~~~~~~~~~~~

functionpopuptest.c:33:66: error: passing argument 2 of 'DrawTextA' makes pointer from integer without a cast [-Wint-conversion]

33 | DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);

| ^~~

| |

| int

C:/raylib/w64devkit/include/winuser.h:3480:50: note: expected 'LPCSTR' {aka 'const char *'} but argument is of type 'int'

3480 | WINUSERAPI int WINAPI DrawTextA(HDC hdc,LPCSTR lpchText,int cchText,LPRECT lprc,UINT format);

| ~~~~~~~^~~~~~~~

functionpopuptest.c:33:76: error: passing argument 4 of 'DrawTextA' makes pointer from integer without a cast [-Wint-conversion]

33 | DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);

| ^~

| |

| int

C:/raylib/w64devkit/include/winuser.h:3480:78: note: expected 'LPRECT' {aka 'struct tagRECT *'} but argument is of type 'int'

3480 | WINUSERAPI int WINAPI DrawTextA(HDC hdc,LPCSTR lpchText,int cchText,LPRECT lprc,UINT format);

| ~~~~~~~^~~~

C:/raylib/raylib/src/raylib.h:174:35: error: incompatible type for argument 5 of 'DrawTextA'

174 | #define LIGHTGRAY CLITERAL(Color){ 200, 200, 200, 255 } // Light Gray

| ^~~~~~~~~~~~~~~~~~~~~~

| |

| Color

functionpopuptest.c:33:80: note: in expansion of macro 'LIGHTGRAY'

33 | DrawText("Congrats! You created your first window!", 190, 200, 20, LIGHTGRAY);

| ^~~~~~~~~

C:/raylib/w64devkit/include/winuser.h:3480:88: note: expected 'UINT' {aka 'unsigned int'} but argument is of type 'Color'

3480 | WINUSERAPI int WINAPI DrawTextA(HDC hdc,LPCSTR lpchText,int cchText,LPRECT lprc,UINT format);

| ~~~~~^~~~~~

functionpopuptest.c:35:13: error: implicit declaration of function 'make_popup_window' [-Wimplicit-function-declaration]

35 | make_popup_window("Hello", "title")

| ^~~~~~~~~~~~~~~~~

functionpopuptest.c:35:48: error: expected ';' before 'EndDrawing'

35 | make_popup_window("Hello", "title")

| ^

| ;

36 |

37 | EndDrawing();

| ~~~~~~~~~~

functionpopuptest.c:43:5: error: too few arguments to function 'CloseWindow'; expected 1, have 0

43 | CloseWindow(); // Close window and OpenGL context

| ^~~~~~~~~~~

C:/raylib/w64devkit/include/winuser.h:2282:29: note: declared here

2282 | WINUSERAPI WINBOOL WINAPI CloseWindow (HWND hWnd);

| ^~~~~~~~~~~

make[1]: *** [Makefile:549: functionpopuptest.o] Error 1

make[1]: Leaving directory 'C:/Users/prasa/OneDrive/Desktop/raylibcfuncitnos'

make: *** [Makefile:539: all] Error 2

<<< Process finished (PID=16628). (Exit code 2)

&gt; Reset Environment

--------------------------

ENV_UNSET: PATH

$(SYS.PATH) has been restored

&gt; Execute program

-----------------------

cmd /c IF EXIST %function_testing%.exe %function_testing%.exe

Process started (PID=15468) >>>

<<< Process finished (PID=15468). (Exit code 0)

================ READY ================"

also I'm contributing and made a new function called "make_popup_window" but I need to fix this first.

just felt like I had to let you know.

youtube.com
u/prasan4849 — 1 month ago

Should I make one small game everyday?

I'm making pong and saw the gmtk jam 2026 and so I wanted to join, but then I remembered how I didn't practice my coding skills for the last game jam I joined. So to practice them, I am thinking of making one small game everyday, is this a good idea?

reddit.com
u/prasan4849 — 1 month ago

how to make a native popup

So i just wanted to make a popup in rmmz but I want it to be native, for that I need a c++ dll, I'm learning c++ so coding the popup shouldn't be too hard but I don't know how to even add my dll into rmmz, how do I do it?

reddit.com
u/prasan4849 — 1 month ago
▲ 2 r/raylib

I don't understand why my movement code isn't working.

I fixed three of seven errors but I don't understand the last four since to me as a beginner this looks like it doesn't, here are the errors:

expected ';' before 'InitWindow'

'r' was not declared in this scope

unused variable 'SCREEN_WDITH' [-Wunused-variable]

unused variable 'SCREEN_HEIGHT' [-Wunused-variable]

And this is the code itself its c++ since that's the language I'm learning:

#include "raylib.h"


int main(){
    // Initialize
    int x = 400;
    int y = 225;
    const int SCREEN_WIDTH = 1920;
    const int SCREEN_HEIGHT = 1080;


    SetConfigFlags(FLAG_FULLSCREEN_MODE);


    InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "Puzzle Switch");


    // Gameloop
    while (!WindowShouldClose()){
        // Render
        BeginDrawing();
        ClearBackground(RAYWHITE);
        DrawRectangle(100, 100, x, y, BLUE);
        EndDrawing();
        DrawText("Move the rectangle using the arrow keys.", 190, 200, 20, LIGHTGRAY);
        if (IsKeyDown(KEY_RIGHT)) x++;
        if (IsKeyDown(KEY_LEFT)) x--;
    }


    // Deinitialization
    CloseWindow();
    return 0;
}
reddit.com
u/prasan4849 — 2 months ago
▲ 0 r/raylib

how do I make a computer pop up?

I am making a game in c++ and wanted to make a popup the second you start the game and I mean a real computer pop up not one on the screen, how do I do that?

reddit.com
u/prasan4849 — 2 months ago