mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: deprecate short struct init (#10842)
This commit is contained in:
@ -32,5 +32,5 @@ pub fn (mut particle Particle) tick(mut rocket Rocket, mut ctx gg.Context) {
|
||||
particle.pos += particle.vel
|
||||
particle.draw(mut ctx)
|
||||
|
||||
particle.accel = {}
|
||||
particle.accel = Vector{}
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ pub fn (mut rocket Rocket) tick(mut ctx gg.Context) {
|
||||
rocket.pos += rocket.vel
|
||||
rocket.draw(mut ctx)
|
||||
|
||||
rocket.accel = {}
|
||||
rocket.accel = Vector{}
|
||||
}
|
||||
|
||||
for mut particle in rocket.particles {
|
||||
@ -50,10 +50,10 @@ pub fn (mut rocket Rocket) tick(mut ctx gg.Context) {
|
||||
pub fn new_rocket() Rocket {
|
||||
return Rocket{
|
||||
color: random_color()
|
||||
pos: {
|
||||
pos: Vector{
|
||||
x: rand.f32_in_range(50, get_params().width - 50)
|
||||
}
|
||||
vel: {
|
||||
vel: Vector{
|
||||
x: rand.f32_in_range(-1.5, 1.5)
|
||||
y: rand.f32_in_range(5, 7)
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ pub fn random_vector_in_circle() Vector {
|
||||
theta := rand.f32n(2 * math.pi)
|
||||
y := rand.f32()
|
||||
|
||||
return {
|
||||
return Vector{
|
||||
x: f32(y * math.sin(theta))
|
||||
y: f32(y * math.cos(theta))
|
||||
}
|
||||
|
Reference in New Issue
Block a user