~Hakurei Shrine~ > Rika and Nitori's Garage Experiments
※ Danmakufu Q&A/Problem thread 3 ※
Sparen:
--- Quote from: DLS on February 18, 2016, 09:48:25 PM ---But can't you simulate time stop by stopping the pellets / knives and using SetPlayerSpeed(0, 0);, and if possible get the player speed before "stopping time"?
--- End quote ---
Yes you can. But manually 'stopping time' is a major hassle that involves communicating between different scripts and large-scale array accesses. Additionally, like with Python's Artifact 3, it's a royal pain to debug because everything must be restored if the boss attack is cleared during timestop (which caused his player speed and forbid shot/spell to be disabled for the rest of the game until he fixed it).
There are ways to do it but there is no one *good* way.
DLS:
And that's why you don't hand your stopwatch to a fox.
Oh...
Also, would it be bad if you defined the player speed on @Initialize of the first script knowing that your script lets you choose any player you have?
Jimmy:
Hello there folks,
I'm stuck with the attempt to make a 3D render of the red circle that spins around the boss:
http://pastebin.com/M12w2ZuA
I went with creating a 3D-sprite of the graphic first and applying its properties, including positioning it right at the boss' coordinates.
However, the graphic is rendered at a completely different place than the boss sprite, although still moving at exactly the same speed and in the same direction as the boss does.
I've already tried a number of things with the destination rectangle and the x,y-coordinates, but the circle doesn't position itself right at the boss.
That all worked just fine for the 2D-sprite version of it.
Anyone's got an idea?
Helepolis:
Well, you're both pointing out the problem and the answer slightly yourself :V
You're using a regular render function to mutate a 3D sprite object. The coordinates of a 3D sprite are based on the XYZ of the danmakufu 3D space and the 2D sprites are based on the game field, except when you set the Layer 80+ (or 0.8 if you're using the regular one), which then the entire window of the program become the coordinates. To clarify:
Let us say your game field is X: 200 and Y: 400. You decide to centre your boss using your own GetCenterX / GetCenterY code (Which is field / 2). The boss X,Y position is 100,200. Imagine we try to draw a texture/sprite on Layer 80 using the same functions. We have to keep in mind that our Danmakufu window is by default 640x480. Drawing our texture and giving the GetCenterX/Y will put it at 320,240. Because after all, that is the centre of the whole window. Obviously this won't align with the boss, as they are calculating their coordinates differently. But what if we put our texture on Layer 30? Suddenly, it will align proper, as both are calculating the centre based on the play field.
The same story goes for 3D, except more complicated when you're involving the camera. First of all, 3D coordinates of danmakufu are fixed. If you put something at 0,0,0 in 3D space and you put your camera -256 on the X-axis, your sprite will be off-centre for you, but in terms of code it is still located 0,0,0.
TL DR: You don't want to mix 2D ad 3D to align things because generally it will be a hassle regardless.
Is it an aesthetic thing you wish to put your magic circle in 3D? The 2D sprite allows X Y Z angling as well. Or you think that looks a bit too "thin paper"?
Alternative solution I can offer you is a Mesh object. Because it takes the function: ObjMesh_SetCoordinate2D(obj,boolean); http://dmf.shrinemaiden.org/wiki/Mesh_Object_Functions#ObjMesh_SetCoordinate2D which then allows you to use 2D coordinates. Had similar issue with my Tewi Mochi hammer in my game. So what you need to do is:
- Make a flat mesh object in a 3D modelling program.
- Texture it with the magic circle
- Summon it in your script using the mesh functons
- Set the ObjMesh_SetCoordinate2D to true.
- Continue further using regular ObjRender functions.
Either use 2D sprite and angle it X Y Z giving it that "3D-ish" feeling. Or use the Mesh trick.
Edit note: explaining more added to original post.
Jimmy:
--- Quote from: Helepolis on February 19, 2016, 08:00:38 AM ---Well, you're both pointing out the problem and the answer slightly yourself :V
You're using a regular render function to mutate a 3D sprite object. The coordinates of a 3D sprite are based on the XYZ of the danmakufu 3D space and the 2D sprites are based on the game field, except when you set the Layer 80+ (or 0.8 if you're using the regular one), which then the entire window of the program become the coordinates. To clarify:
Let us say your game field is X: 200 and Y: 400. You decide to centre your boss using your own GetCenterX / GetCenterY code (Which is field / 2). The boss X,Y position is 100,200. Imagine we try to draw a texture/sprite on Layer 80 using the same functions. We have to keep in mind that our Danmakufu window is by default 640x480. Drawing our texture and giving the GetCenterX/Y will put it at 320,240. Because after all, that is the centre of the whole window. Obviously this won't align with the boss, as they are calculating their coordinates differently. But what if we put our texture on Layer 30? Suddenly, it will align proper, as both are calculating the centre based on the play field.
The same story goes for 3D, except more complicated when you're involving the camera. First of all, 3D coordinates of danmakufu are fixed. If you put something at 0,0,0 in 3D space and you put your camera -256 on the X-axis, your sprite will be off-centre for you, but in terms of code it is still located 0,0,0.
TL DR: You don't want to mix 2D ad 3D to align things because generally it will be a hassle regardless.
Is it an aesthetic thing you wish to put your magic circle in 3D? The 2D sprite allows X Y Z angling as well. Or you think that looks a bit too "thin paper"?
Edit note: explaining more added to original post.
--- End quote ---
Whoops, totally forgot that the 3D objects are affected by the camera angles and position :V
Considering that, I adjusted the camera settings and it works well by now. Currently fiddling around with the background graphics, but that's ok.
Yep, it's just an aesthetic thing, I guess I like the 'real' 3D rendition a bit too much (damn I'm way too picky with stuff).
Thanks! :D