#Hastebin: Send and Save Text or Code Sni...
1 messages · Page 1 of 1 (latest)
sure!
also if you want i can provide a screen recording tho id need to lelearn how to use obs lmao
im lookin over teh first script u sent that inherits from Powerup, do u have that script too?
yea one second
that couldn't hurt, the more information the better
using System.Collections.Generic;
using UnityEngine;
public class powerupscript : MonoBehaviour
{
public Powerup powerup;
private void OnTriggerEnter2D(Collider2D collision)
{
Destroy(gameObject);
powerup.Apply(collision.gameObject.GetComponent<BirdScript>());
}
}
thats the whole powerupscript
okay give me a second then
cool, i was just making sure that Apply() wasn't being called more than once
You could try using a fixed spawn rate by using Time.fixedDeltaTime instead of Time.deltaTime when updating the timer variable. This would ensure that the pipes are spawned at a consistent rate regardless of the frame rate of the game.```
maybe its framerate? maybe ur frames drop when u pickup the powerup and ur pipe instantiates before or after it technically should... i don't see anything that stands out tbh
ya i think thats the problem
when u scale using time.delta time ur technically multiplying
in ur case ur adding.. soo.. if ur game runs faster, the timer will have more added onto it
than if ur running a lower frame rate
as you can see the first offset pipe after the powerup is not always in the same place, sometimes spawing practically on top of the last powerup pipe
alright ill try it
try substituting fixedDeltaTime instead
it may not spawn exactly wher eu want them to, but u can adjust that by multiplying a multiplier to adjust it
but what u wanna be looking for is if that change causes them to spawn more consistently
it doesnt seem to fix it, it only made the powerup pipes spawn further away from each other at the very end of a powerup
🤔 hmm thats all i got for now
ill tell ya wat tho, when i get more free time i'll try to pull them scripts into my own project set it up with cubes or something and see if i can work out whats going on
don't have the time to do it right now, but i'll remember, and give u a ping if i turn up anything, until then keep trying to get some answers i guess.. someone more code savvy than me might turn up and have the solution in their back pocket
thats how it looks now if thats useful
the first pipe after powerup still spawns inconsitantly
alright sure!
and thank you
oh yea that very first pipe is supposed to be like that
summed up in one screenshot, this is immediately after picking up the powerup, and the pipes nearest to the player spawned in on top of the ones that wer already there
ohh yea?
ohh no i see
the pipe nearest the player was already there
the 2nd set of pipes spawned in on top o fit
yea i basically made the powerup bubble appear right above the bird so he immidiently picks him up, that first pipe is the pipe from spawn pipe method in the start
cool cool, that clears it up some more, hopefully theres enuff info here to get some help w/ it
so ye thats not an issue
i sure hope so, ill experiment more with this time.deltatime i suppose in the meantime
use debugs
Debug.Log() ur time variable when u instantiate a new pipe, and then debug.log it again after ur code resets it with the new time
in the console that should give u an idea of why ur pipes are spawning the way they do
@lament mauve is that good enough?
know I get it
when using the powerup you are not using the "spawn offsets"
I thougth that "first born is horizontal" was literally -90 degrees
try to giving a value
a starting one
when you use the power up the bird doesnt have grav
and when calculating position from the bird pos
you doesnt have any variation
but if you has a starting value for the offset
and then random - or +
it should be fine
protected float hight = 2.75f;
void spawner()
{
float lowest = transform.position.y - hight;
float highest = transform.position.y + hight;
if (timer < spawn_rate)
{
timer += Time.deltaTime;
}else {
// Instantiate (prefab, with vector 3(same X, rangom Y between lowest and highest, 0 Z), same rotation as prefab);
Instantiate(pipes, new Vector3(transform.position.x, Random.Range(lowest, highest),0), transform.rotation);
timer = 0;
}
}
void first_spawn()
{
Instantiate(pipes,transform.position, transform.rotation);
}
first declare the offset (my var is hight)
hope that helps

oh alright ill try it and let you know if it works
okey pal
nope
the first spawn is just to have an initial group of pipes
the scene starts with empty obj that spawns pipes
the first spawn is without variant of height, all after it have variations
the function spawner configure it with spawn rate
I followed the same tutorial lol
but changed stuff
sorry im back i had to do something
hold up
that was intended, theyre not supposed to have any height offset
only this pipe is very problematic, will that fix it?
that happens bc u are boosting the pipe speed so it reaches the previous one i think
right?
yea the problem is that pipe i highlighted spawning in random places, sometimes closer to the last pipe of speedability(the closes pipe to it on the left), sometimes furter away from it
and i have no idea why
they have the same spawn rate
but diff speed
when you turn on the speed boost, the non boosted keeps the same but the new reach the non boosted one
pipes from speedbuff (the non offset ones) have different both speed and spawn rate
i thought so too but that wouldnt explain it spawning in random places
I didnt get at all what do you mean about random places
everything that is changed during and after speed buff is in here https://hastebin.com/oduyijeraf.csharp
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
welp look at this picture
the pipe i highlighted sometimes would appear further on the right
or on top of the previous pipe
sorry for bothering you, just wanted to ask if you maybe came up with any other ideas
it doesnt really seem like anyone knows how to solve it lmao
ive tried using pretty much all variants of deltatime and it did affect the spawning but not the way id want it to
actually i got a suggestion that i should change timer based pipe spawning to distance based on
sure, do u know how to make a unity package?
if u could send me the main parts of the code, doesn't need graphics or anything, i could maybe see a better fix
and also, what tutorial u were following
ill figure it out
do you mind if i send it in your dms?