小编L3n*_*L3n的帖子

子弹没有从枪中射出

我正在制作一个只是为了好玩的小游戏而且我被困住使子弹从枪中出来.在下面的代码中,玩家的方向是一个称为角度的角度rot.

代码:

float gunOffsetX = 106, gunOffsetY = 96;
double angle = Math.toRadians(rot); // convert direction of player from degrees to radians for sin and cos
x = getX(); // player X
y = getY(); // player Y

float bulletX = (float) (x + (gunOffsetX * Math.cos(angle) - gunOffsetY * Math.sin(angle)));
float bulletY = (float) (y + (gunOffsetX * Math.sin(angle) + gunOffsetY * Math.cos(angle)));

Instances.fire.add(new Fire(bulletX, bulletY, rot, weapon));
Run Code Online (Sandbox Code Playgroud)

还尝试过:

bulletX = (float) (x + Math.cos(angle + …
Run Code Online (Sandbox Code Playgroud)

java math game-physics

13
推荐指数
1
解决办法
364
查看次数

如何在驱动程序中从PEPROCESS读取导入地址表?

我正在编写驱动程序以创建防病毒程序。但是,我只能从进程中读取导入地址表。

我有一个CreateProcessNotify

VOID CreateProcNotify(HANDLE  ParentId, HANDLE  ProcessId, BOOLEAN Create)
{
    UNREFERENCED_PARAMETER(ParentId);
    UNREFERENCED_PARAMETER(Create);
    PEPROCESS Process;
    KAPC_STATE Apc;
    PVOID ModuleBase;

    // From PID to PEPROCESS
    PsLookupProcessByProcessId(ProcessId, &Process);

    // Attach into the target process' memory
    KeStackAttachProcess(Process, &Apc);

    ModuleBase = GetModuleBase(Process);

    PIMAGE_IMPORT_DESCRIPTOR pImportAddressTable = GetIAT(ModuleBase);

    DPrint("Imports of [Meias] are: \n");
    DPrint("IAT: %x\n", pImportAddressTable);
    // Iterate all Modules Imports
    while (pImportAddressTable->Name != 0) {
        DPrint("{%s}, ", (PCHAR)((ULONG)ModuleBase + (pImportAddressTable->Name)));

        pImportAddressTable++;
    }

    // Unattach ourselves from the target process' memory
    KeUnstackDetachProcess(&Apc);
} …
Run Code Online (Sandbox Code Playgroud)

c c++ drivers windbg portable-executable

6
推荐指数
1
解决办法
449
查看次数

标签 统计

c ×1

c++ ×1

drivers ×1

game-physics ×1

java ×1

math ×1

portable-executable ×1

windbg ×1