top of page

Support Group

Public·2 members

Hitbox Script.txt

In Danmakufu, there are two types of enemy hitboxes - one registers collision with the player, and the other registers collisions with player shots. You can also manually create hitboxes for other types of collisions. The primary two functions you will use are the following: ObjEnemy_SetIntersectionCircleToShot() and ObjEnemy_SetIntersectionCircleToPlayer(). Their names basically describe what they do. They require 4 arguments each - the first is the object ID of the enemy to damage. The next two are the x and y positions to set the hitbox - yes, this means you can have a hitbox somewhere other than directly on top of the boss. If you want to use the boss's position, use ObjMove_GetX(objBoss) and ObjMove_GetY(objBoss). The final argument is the radius of the hitbox, measured in pixels. 32 and 24 for shot and player respectively are the hitbox sizes shown in the sample scripts. You can do whatever you want, but just keep in mind that you will usually want the player collision hitbox to be smaller than the shot collision hitbox.

Hitbox Script.txt

Put these two functions inside @MainLoop. Enemy collision hitboxes reset after each frame, and by putting this code in @MainLoop, the hitboxes will move themselves to the enemy's position as long as you are using the ObjMove_GetX() and ObjMove_GetY() functions.

Now I will show the @MainLoop style. First, you will want to define a global variable count (or frame, but I prefer count) after the shotsheet include, and set it to 0. Then, in @MainLoop, you will add the following after the hitbox declaration and before the yield;:

Finally, I will discuss my coding method, which is similar to the @MainLoop method. The main difference is that I do not reset the counter and instead use a modulus. The @MainLoop code I insert between the hitboxes and yield; is similar to the following: 041b061a72


Welcome to the group! You can connect with other members, ge...
Group Page: Groups_SingleGroup
bottom of page