How to make this ? Just any ideas

Godot Version

3

I saw this guys game and was wondering how he create from this 2d sprite


to like this
pbXtPl
and i want to create something like this but only using 2d graphics and also want to make an spaceship to rotate around the star like in real life.Any ideas how to make it ?

i was using this code but its looks soo bad Circular movement :: Godot 3 Recipes its rotating not as i want

1 Like

It’s probably not 2D.

The way the interior of the ring around the sun becomes more visible as the camera moves would be a massive pita in 2D imo (some shader sorcery perhaps). Seems more likely this is a 3D scene with a low poly aesthetic and a static camera angle, with a low FPS animation style making it appear 2D-ish.

The ship being 2D is entirely reasonable, would just need to create a flipbook of available rotation angles from a static viewpoint, though again, probably isn’t 2D because why bother.

1 Like

Okay very interesting but is it possible to create not a game like this but similar rotation around star? (In 2d)

This should be possible with shaders and the rotation should also not be too difficult, if youre talking about the planets and ship

1 Like

If that star’s 2D… notice how it looks round? That’s probs just the animation being good but it definitely looks at the very least like a recording of a 3D object being played there.
It wouldn’t really work for the sun, being the light source itself, but if you want 2D planets to look round via shadows, try this:

1 Like

Is there any tutorials because I have no idea gow to make it

Okay very interesting how to create my star normal map it must be like circle or not?

I used shaders to get that 3d effect but i think its looks very bad and dont now how to make that rotation


i am using this normal map, am i right ?

Whats your shader code?

shader_type canvas_item;


uniform sampler2D normal_map : hint_normal;


uniform vec2 light_dir = vec2(0.5, -0.5);

void fragment() {
    
    vec4 albedo = texture(TEXTURE, UV);
    
    
    vec3 normal = texture(normal_map, UV).rgb;
    normal = normalize(normal * 2.0 - 1.0); // Convert from [0, 1] to [-1, 1]
    
    
    vec3 light = normalize(vec3(light_dir, 1.0));
    float intensity = max(dot(normal, light), 0.0);
    
    
    COLOR = albedo * intensity;
}

I have something like this but its too bad for shaders becuase every time i try to use them its looks like this star

1 Like
extends Node2D
@onready var p: Sprite2D = $P
@onready var s: Sprite2D = $S

const ORBITAL_PATH : Array[Vector2]=[
	Vector2(-250,0),
	Vector2(-211,-104),
	Vector2(-118,-172),
	Vector2(-39,-207),
	Vector2(67,-201),
	Vector2(140,-137),
	Vector2(177,-73),
	Vector2(220,-12),
	Vector2(250,0),
	Vector2(225,59),
	Vector2(139,91),
	Vector2(73,93),
	Vector2(1,85),
	Vector2(-34,86),
	Vector2(-73,93),
	Vector2(-139,91),
	Vector2(-225,59),
	Vector2(-250,0),	
]

var index:int = 0
func _process(delta: float) -> void:
	if int(fmod(delta,120))==0:
		s.position = ORBITAL_PATH[index]
		index+=1
		if index==ORBITAL_PATH.size():
			index=0

moving the ship 2dSprite around a fixed path. just the look of it. you could do some smoothing or add more points. depending on your end goals. if you just want the look of something over a realistic orbit.

1 Like

Firstly, probably not. To create the illusion of a sphere, use something more like this:


Secondly, normal maps are about shadows. You can’t really cast shadows on the sun, so you probably don’t need one for it.
(In the event that a visible shadow is successfully cast on the sun, we will have much bigger problems than game development)
What I meant by ‘recording’ was, it looks like a rotating 3D object. If it isn’t, it’s probably a video of a 3D model being rotated - notice how sunspots seem to appear and disappear at the sides - with some particle effects thrown in.

1 Like

I tried it but made some changes because i am using godot 3 but it still orbiting not like i want

extends Node2D

onready var star: AnimatedSprite = $Star
onready var spaceship: AnimatedSprite = $SpaceShip


const ORBITAL_PATH = [
	Vector2(-300, 0),
	Vector2(-250, -150),
	Vector2(-150, -250),
	Vector2(0, -300),
	Vector2(150, -250),
	Vector2(250, -150),
	Vector2(300, 0),
	Vector2(250, 150),
	Vector2(150, 250),
	Vector2(0, 300),
	Vector2(-150, 250),
	Vector2(-250, 150),
	Vector2(-300, 0)
]

var index: int = 0
var move_speed: float = 200.0  

func _process(delta: float) -> void:
	if index < ORBITAL_PATH.size():
		
		var target_position = star.position + ORBITAL_PATH[index]

	
		spaceship.position = spaceship.position.move_toward(target_position, move_speed * delta)


		if spaceship.position.distance_to(target_position) < 1.0:
			index += 1
			if index == ORBITAL_PATH.size():
				index = 0

1 Like

yes you are right there is no shadows on the sun but with this normal map it looks more realistic but its now just becoming invisible (

I am thinking maybe just this space scene create like 3d scene and the spaceship 3d too? Maybe that will be easier but is there any way to make 3d ball use that my pixel sun texture ?Okay i just understand that i cant use that 3d because i dont know how to texture and animate a 3d ball in godot with sprite sheet

for accuracy i want like this


but i think creating with 3d is more easier(but i saw that i need to animate using script so its not easy😅)

Your pixel sun looks good, but there has to be a better way to code the flight path than to brute force it like that. I’d use the actual equation of a circle for that (maths I know). Try the old (x – h)^2 + (y – k)^2 = r^2 which in gdscript is pow((x – h), 2) + pow((y – k), 2) - pow(r, 2) = 0.
(h, k) is the (x, y) of the middle of the path and r is its radius. Though you’d probably have to convert that into two functions, one for each half-circle. So that’s
if y <= k:
[tab]x = h - pow((pow((y – k), 2) - pow(r, 2)), 0.5)
else:
[tab]x = h + pow((pow((y – k), 2) - pow(r, 2)), 0.5)
…maybe.
Honestly I don’t trust that I got that right but if you want a good circle you will absolutely need something like that. And about the rotation of the ship, you could probably teleport something to you at the end of each frame, then before it teleports to you again next frame, get the angle from it to you and point the sprite that way. Hope this helps

(replied to the wrong thing first time around)

1 Like

Thanks thats helped me very much !

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.