First, Thank you all, I’m really amazed on how responsive and cheerful you guys are .
Now, this is the code I’m running:
local gravity = -0.03
local tapped = false
local max_bird_angle_left = vmath.quat_rotation_z((math.pi) / 4)
local max_bird_angle_right = vmath.quat_rotation_z(-math.pi / 2)
function init(self)
msg.post(".", "acquire_input_focus")
self.velocity = vmath.vector3(0, 0, 0)
self.angle = vmath.quat()
self.rotation_angle = vmath.quat()
self.bird_direction = vmath.quat()
self.rotation_speed = 0.001
end
function update(self, dt)
local pos = go.get_position()
pos = pos + self.velocity
self.velocity.y = self.velocity.y + gravity * dt
self.rotation_angle = vmath.slerp(self.rotation_speed, self.rotation_angle, max_bird_angle_right)
go.set_position(pos)
go.set_rotation(self.rotation_angle)
end
function on_message(self, message_id, message, sender)
if(message_id == hash("tap") and tapped == false) then
self.velocity.y = 0.24
self.rotation_angle = vmath.quat_rotation_z(45 * math.pi / 180)
tapped = true
else
if(self.velocity.y < -0.02) then
self.velocity.y = -0.02;
tapped = false
end
end
end
function on_input(self, action_id, action)
if action_id == hash("tap") then
msg.post('#', 'tap')
end
end
( Sorry for the hacky tap thing, I still don’t know how to handle taps! )
I followed the car game tutorial but also wanted to make something different.
The project is organized in folders. Is that bad?
- main
- audio
- collections
- bird.collection
- background.collection
- scripts
- sprites
My project settings at the moment are:
graphics
default_texture_min_filter: linear
default_texture_mag_filter: nearest
max_debug_vertices: 10000
texture_profiles: /builtins/graphics/default.texture_profiles
On the desktop I notice that when I scale up the window, to something like 800x600 the game starts getting slow.
Do you have any clue on what’s going on?
TIA!
~ mobs