~Hakurei Shrine~ > Rika and Nitori's Garage Experiments
※ Danmakufu Q&A/Problem thread 3 ※
<< < (362/366) > >>
BananaCupcakey:
How to make a function so that the bullet is gradually increasing/decreasing the alpha ? Had no idea how it works, any help is appreciated.
JDude :3:

--- Quote from: BananaCupcakey on August 24, 2019, 03:26:18 PM ---How to make a function so that the bullet is gradually increasing/decreasing the alpha ? Had no idea how it works, any help is appreciated.

--- End quote ---


--- Code: ---function upAlpha(obj, seconds){
ascent(i in 0..256){
ObjRender_SetAlpha(obj, i);
wait(60*seconds);
}
}

function wait(n){loop(n){yield;}}

--- End code ---

Pretty simple, but it works with the time as a parameter: if you do upAlpha(obj, 1.5) the alpha will be increased each 1.5 seconds
Dire29:
Hey there! I was just wondering how to make a player shoot bullets. I'm trying to make a player script and I can't for the life of me figure out how to go about doing that. Does anyone have tips to start off doing that at least?
theSlug:

--- Quote from: Dire29 on September 21, 2019, 04:54:01 PM ---Hey there! I was just wondering how to make a player shoot bullets. I'm trying to make a player script and I can't for the life of me figure out how to go about doing that. Does anyone have tips to start off doing that at least?

--- End quote ---

I'm not very expirenced with ph3 in general, but for the player script I've made I've followed thesse steps:

* Have an image containing the sprite of the shots
* Create a "player shotdata"
* Load that Shot data in the player script
* Make the player actually shoot
The shot data (2) must be something like this:


--- Code: ---shot_image = "./playershot.png" // image

ShotData {
id = 1
rect = (left,top,right,bottom)
render = ALPHA
alpha = x // 0-255
collision = y // radius of the hitbox
}

ShotData {
id = 2
...

--- End code ---

the item (3) it's just store the path of the shotdata in a variable and load it in @initialize

--- Code: ---let shots = dirCurrent ~ "player_shot.txt";
LoadPlayerShotData(shots);

--- End code ---

Now you can use CreatePlayerShotA1 and it shoud work
Dire29:
Thank you for the advise! Quick question though do I implement it like this?

task TShoot(){
   CreatePlayerShotA1(GetPlayerX(), GetPlayerY(), 3, 2, 10, 10, 1);
}
Navigation
Message Index
Next page
Previous page

Go to full version