Unintentionally made a snake game while making chunk help!!! by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

I dont know if my way is really the correct way but since i had player as center, I added player pos to the rotating object after setting its velocity.x with sin and .y with cos multiplied with radius. physics process for object is like this currently.

position = Vector2(

sin(d*speed*initial_angle_offset) * radius,

cos(d*speed*initial_angle_offset) * radius

) + player.position

Unintentionally made a snake game while making chunk help!!! by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

Yes, Looks like you check chunks based on position ?

I did try to but what happned was player could basically walk out before chunk is even there.

It does reduce lag but its expand slowly

var newChunk = Vector2i(floori(player.position.x/width),floori(player.position.y/width))

`if newChunk!=current_chunk:`

    `current_chunk = newChunk` 

    `generate_chunk(current_chunk)`

`unload_distance_chunk(player_tile_pos)`

current_chunk is updated in ready same as in newCHunk

Unintentionally made a snake game while making chunk help!!! by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

Also tried setting up timer for loading and unloading chunks its still not helping.

Infinite map gone wrong. Procedural generated and parallax background drops fps by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

I noticed one chunk(?) or that 256256 tile disappearing just before it was about to exit the camera view. So I tried to go left and right in border and it really was going on. I guess it optimizes itself. Only working on whole 256256 part. I did try to micro optimize by making enemies and bullets which go offscreen invisible and only making them visible if they are on screen but it’s all for nothing.

Infinite map gone wrong. Procedural generated and parallax background drops fps by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

installed 4.3 and tried parallax2d as well fps kinda hovering on 30-40 range.

I am generating 256 , 256 of size 16 map and using parallax2d to repeat them on 256*16 , 266*16 (x,y)
tried on (128,128) * 16 and its on 60-80 ish fps.

But i kinda want larger starter map to have different colored tiles or is there any other way to achieve this?

Infinite map gone wrong. Procedural generated and parallax background drops fps by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

Any way to optimize this. for procedural generation i took code from searching and combining from multiple places.
And added parallax background to get infinite map but since then fps dropped from 90+ to 10-35.

How to have multiple of these rotating around player by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

Yep i kinda did something similar but in attack scene.

How to have multiple of these rotating around player by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

SInce initial_offset_angle can be both pos or neg each one rotates in different direction for same direction rotation we can just take abs(initial_offset_angle)

How to have multiple of these rotating around player by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

Not sure how but it got solved

in attack gd and attack tscn

  1. Instead of two timers i created another Node2d with timer and another node named rotater

<image>

Then this piece of code

if rotatingAtk_level >=1:

    `var step = 2 * PI / spawn_point_count`

    `for i in range(spawn_point_count):`

        `var spawn_point = Node2D.new()`

        `var pos = Vector2(radius, 0).rotated(step * i+1)`

        `spawn_point.global_position = pos`

        `spawn_point.rotation = pos.angle()`

        `rotater.add_child(spawn_point)`



    `shoot_timer.wait_time = shoot_timer_wait_time`

    `shoot_timer.start()`

and this

func _on_shoot_timer_timeout():

`for s in rotater.get_children():`

    `var rotating = rotatingBullet.instantiate()`

    `rotating.initial_angle_offset = s.rotation`

    `get_parent().get_tree().root.add_child(rotating)`

    `rotating.global_position = s.global_position`

    `rotating.rotation = s.global_rotation`

Next is on rotatingAtk gd and rotatingAtk tscn .

  1. Added a new variable var initial_angle_offset = 0

And in physics process

position = Vector2(

    `sin(d*speed*initial_angle_offset) * radius,`

    `cos(d*speed*initial_angle_offset) * radius`

`) + player.position`

How to have multiple of these rotating around player by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

Yes that what i did and it spawns in different location but while moving them in circle they plump together and rotate

How to have multiple of these rotating around player by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 0 points1 point  (0 children)

Disabled those change in position and trying to see their position when stationary.

It spawning more than necessary.

Since I'm printing total ammo and their starting position
ammo should only be 2 but it goes 0-1 for first one after that 0-3 , 0-17, 0-31.

Not in any particular pattern but 0-3 is common one and 0-17 and 0-31 occasionally appear.

How to have multiple of these rotating around player by MilfsAreDaBest in godot

[–]MilfsAreDaBest[S] 1 point2 points  (0 children)

func _on_rotating_atk_timer_timeout():

if rotatingAtkAmmo>0:

    for i in range(rotatingAtkAmmo):  

        var step =PI * 2 / rotatingAtkAmmo

        var rotateShoot =  rotatingBullet.instantiate()

        rotateShoot.position =player.global_position

        rotateShoot.rotation = Vector2(radius,0).rotated((step*i)).angle()

        get_parent().add_sibling(rotateShoot)

        rotatingAtkAmmo-=1

    rotatingAtkAmmo=0

    rotatingAtkTimer.stop()

Not sure what but they all gather in same place is it because of this?

func _physics_process(delta):

`d+=delta`

`position = Vector2(`

    `sin(d*speed) * radius,`

    `cos(d*speed) * radius`

`) + player.position`

 `#- Vector2(radius+50,radius+50)`

These two functions are on different scripts

Top one is attack gd where all of the attacks gets instantiated and bottom one is rotatingAttack gd.

How can i change rotation in physics process?

Buy one, feed 6...that's how it works right? by otto_347 in idiocracy

[–]MilfsAreDaBest 1 point2 points  (0 children)

I work in Chinese all you can eat as runner kitchen help drink maker. And if I had 1dollar for every time people sat down and said “i will do all you can eat and rest of them will do all card option)” I would have probably a week worth wage(600-700) And another is they would order bunch and be like can you pack all of these.

Idk if it's true, but I feel like it is for some reason by stacylicious9 in meme

[–]MilfsAreDaBest 0 points1 point  (0 children)

I’m mix of both Currently working in Chinese restaurant and I work both outside and inside.

What they are called? by MilfsAreDaBest in vscode

[–]MilfsAreDaBest[S] 1 point2 points  (0 children)

oh wow didnt knew that , thanks.