Author Topic: Making Marisa's Lasers  (Read 450 times)

0 Members and 1 Guest are viewing this topic.

Nickster206

    • Visit my Youtube channel! I document script progress regularly.
  • Gender: Male
Making Marisa's Lasers
« on: April 16, 2020, 07:26:07 PM »
Hi all,

I'm about 2 weeks into learning and experimenting with Danmakufu. I've been testing out some of my own patterns and I understand how enemy lasers work, but I noticed there isn't a default player laser shot, only CreatePlayerShotA1. As a result, I have been having trouble understanding how other scripts make use of player-fired lasers, even after examining their code. I would really appreciate some help with this.

Python

  • Σ = {a, b} L = {w ∈ Σ* | |w| = 2}
  • aa / ba / bb / ab
    • YouTube
    • Python#9486
    • Steam
Re: Making Marisa's Lasers
« Reply #1 on: April 18, 2020, 10:22:37 PM »
CreatePlayerShotA1 isn't the only way to make player shot objects. As a rule of thumb, calling any shot creation function inside a player script will automatically mark that object as a player shot object. This includes CreateShotA1, A2, B1, B2, but also CreateLooseLaserA1, StraightLaserA1 and CurveLaserA1.

However, in order for them to do anything, you need to assign damage to them. Save the object ID in a variable and then use ObjShot_SetDamage and (if necessary, ObjShot_SetPenetration) on your object like so:

Code: [Select]
let obj = CreateLooseLaserA1(params);
ObjShot_SetDamage(obj, dmg);
ObjShot_SetPenetration(obj, pen);

I believe lasers have infinite penetration by default, but don't take my word for it. Experiment yourself. I hope I could be of use to you.  :)

Nickster206

    • Visit my Youtube channel! I document script progress regularly.
  • Gender: Male
Re: Making Marisa's Lasers
« Reply #2 on: April 19, 2020, 01:29:07 AM »
Thank you very much!  :D
I managed to get it working now (https://www.youtube.com/watch?v=s6tpa7cAPGI).

However, I now have an unrelated follow-up question. I've changed Danmakufu's default resolution to 1440x1080. However, the menu that opens up when I first launch the .exe and the menu that appears when you select an option (single, plural, etc...) only accept background images of size 640x480. How do I fix this to accept images of larger resolutions?

Python

  • Σ = {a, b} L = {w ∈ Σ* | |w| = 2}
  • aa / ba / bb / ab
    • YouTube
    • Python#9486
    • Steam
Re: Making Marisa's Lasers
« Reply #3 on: May 16, 2020, 01:27:43 AM »
If that's the case then I think DNH's main menu may be hardcoded in that regard. You can't change it. Though that shouldn't be thaaaaat big of a deal since it's just a way to navigate to your different scripts to run them, there shouldn't be any need to necessarily change the background, especially since you absolutely cannot change the menu itself. So if you want a custom main menu for your script, Package scripts are the way to go.