Bullet Issue

new topic     » topic index » view thread      » older message » newer message

Hi all,

Why does the bullet appear to be shown as a growing longer circle when the bullet gets fired? Am I missing a certain step?

Using Greg's FFI Library and my Raylib wrapper version 5.5

[https://github.com/gAndy50/EuRayLib5/tree/main]

include std/ffi.e 
include raylib.e 
 
atom Width = 1024 
atom Height = 720 
 
InitWindow(Width,Height,"Bullets") 
 
SetTargetFPS(60) 
 
atom bullet_speed = 1.0 
 
sequence bullets = {} 
 
integer bullet_visible = 0 
 
sequence bullet_pos = {GetScreenWidth() / 2, GetScreenHeight() / 2} 
 
while not WindowShouldClose() do 
 
	if IsKeyPressed(KEY_SPACE) then 
		bullets = append(bullets,bullet_pos) 
		bullet_visible = 1 
	end if 
	 
	for i = length(bullets) to 1 by -1 do 
		bullet_pos[1] += bullet_speed 
		 
		if bullet_pos[1] >= GetScreenWidth() then 
			bullets = remove(bullets,i) 
			continue 
		end if 
	end for 
 
	BeginDrawing() 
	 
	if bullet_visible = 1 then 
		DrawCircleV(bullet_pos,20,RED) 
	end if 
 
	EndDrawing() 
end while 
 
CloseWindow() 
new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu