I would do it as a code, the sphere is not that complicated.
Perhaps the number is difficult to rotate
A similar thing:
[BAX] [XUI] SD XUI_View3D
I created a library to display polygons in 3D. It is also possible to use it to create 3D XUI views. This library can be used to create 3D models from code or load them from obj files. To create a 2D drawing app, to create games, animations, introductions, and 3D effects You can find a detailed...www.b4x.com
i would like to use a 2d game engine that i am familiar with and i am also pretty sure b4x doesnot have a 3d game engine.This might be a stupid question, but wouldn't it be easier to just do it as a 3D game? The camera could still be positioned so it looks 2D.
Let's say that it is not complicated also because it is a very simple 'engine' and with not many lines of code.this is amazing. i have no idea how to create a 3d object. need to start study about it.
Great. I'm really curious to see, you will surely do something extraordinaryi think i have an idea. i am not sure if it will work but something came to my mind i will have to try it out. will share with you later the results
btw. this is the framework of apple: https://developer.apple.com/documentation/scenekit/
i am sure it is simple as Spritekit and very similar so such a lib would be perfect!
#Region Project Attributes
#MainFormWidth: 510
#MainFormHeight: 510
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private cnv As B4XCanvas
Private redBall As B4XBitmap
Private xui As XUI
Private timer As Timer
Private vpw, vph As Float
Private speedx As Float = 0
Private speedy As Float = 0
Private leftPos As Float
Private topPos As Float
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
vpw = MainForm.RootPane.Width
vph = MainForm.RootPane.Height
cnv.Initialize(MainForm.RootPane)
redBall = xui.LoadBitmap(File.DirAssets,"redball.png")
leftPos = -vpw
topPos = -vph
timer.Initialize("timer",1000/60)
timer.Enabled = True
End Sub
Sub timer_Tick
clearcnvblackbackground
drawballwithpattern
End Sub
Sub clearcnvblackbackground
cnv.ClearRect(cnv.TargetRect)
cnv.DrawRect(returnRect(0,0,vpw,vph),xui.Color_Black,True,0)
End Sub
Sub drawparallexbackground
leftPos = leftPos - speedx
topPos = topPos - speedy
For x = 0 To 2
For y = 0 To 2
cnv.DrawBitmap(redBall,returnRect(leftPos+(x*vpw),topPos+(y*vph),vpw,vph))
Next
Next
If leftPos <= -vpw*2 Then leftPos = -vpw
If topPos <= -vph*2 Then topPos = -vph
If leftPos >= 0 Then leftPos = -vpw
If topPos >= 0 Then topPos = -vph
End Sub
Sub drawballwithpattern
Dim ballshape As B4XPath
ballshape.InitializeOval(returnRect((vpw/2)-150,(vph/2)-150,300,300))
cnv.ClipPath(ballshape)
drawparallexbackground
cnv.RemoveClip
End Sub
Sub returnRect(x As Float, y As Float, w As Float, h As Float) As B4XRect
Dim r As B4XRect
r.Initialize(x,y,x+w,y+h)
Return r
End Sub
'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
Return True
End Sub
Sub MainForm_MouseMoved (EventData As MouseEvent)
If EventData.X > vpw*0.55 Then
speedx = -3
else if EventData.X < vpw*0.45 Then
speedx = 3
Else
speedx = 0
End If
If EventData.y < vph*0.45 Then
speedy = 3
else if EventData.y > vph*0.55 Then
speedy = -3
Else
speedy = 0
End If
End Sub
I can't speak to the code at all, I have no clue about (pseudo) 3D programming.am i close to the solution?
I can't speak to the code at all, I have no clue about (pseudo) 3D programming.
But as far as the visuals go, I'd say "perhaps somewhat", depending on how you're planning on using it. I mean, the ball would be a lot smaller, which probably would help a lot in covering how it looks slightly off. I would also recommend just removing the number on it, if that's an option for your game. Plus it will help lots once you add the shadow and the highlight on the ball:
View attachment 104514
Excellent. ?ok, i am making some progress. now i will also need to rotate the image.
this is what i have now:
EDIT: video was updated to ver2 of the animation
Don't try to be very precise in relation to the white sphere that rotates within the red one. Although it should be oval, take into account that it has to spin fast and this will already give the optical effect that it is oval.i will explain what i am doing.
i create a patter of the ball flat 2d. then i draw a parallax scrolling animation of 3 full pattern of the ball in 9 different positions to avoid blank area.
now i clip-path an oval in the middle of the screen of the shape of the ball and draw the whole screen to it.
Don't try to be very precise in relation to the white sphere that rotates within the red one. Although it should be oval, take into account that it has to spin fast and this will already give the optical effect that it is oval.
So wasting too much time on it would be of little use, it wouldn't add much to you.
I agree with @Sandman's idea, the number does not go in the image, it must be inserted by code and deformed.
By inserting the light effect as indicated in my previous post you also have an impression of three-dimensionality
Actually my thought was to completely remove the number, if the game would allow for it. As it is now it makes it look more off, and I imagined making code to deform the number and place it correctly to be overly complicated.I agree with @Sandman's idea, the number does not go in the image, it must be inserted by code and deformed.
Even if you don't create the finished game, I still want to play it.Actually my thought was to completely remove the number, if the game would allow for it. As it is now it makes it look more off, and I imagined making code to deform the number and place it correctly to be overly complicated.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?