Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - eleusmario

Pages: [1]
1
Variable Comb(5) String
Variable amt(5) Decimal
Variable result String
Var editMask String
Var x Integer, y Integer

Font Parent.Name = "Courier"

editMask = "0000.00"

Comb(0) = "Extra";                       amt(0) = 38.06
Comb(1) = "Visa";                        amt(1) = 124.62
Comb(2) = "Car Ins";                     amt(2) = 80.59

x = 0; y = 1
While x <= 2
  Position y, 1; Write Comb(x)
  result = Format(amt(x), editMask)
  result = RemoveZeros(result)
  Position y, 20; Write result
  x++; y++
Loop
EndProgram

Function RemoveZeros(S String) String
Var C Integer, T Integer, V String

T = StrPos(S, ".") - 2
C = 1
V = SubStr(S, C, 1)
While C <= T And V = "0"
  V = SubStr(S, C, 1)
  If V = "0"; RepStr S, " ", C, 1 ; EndIf
  C++
Loop
Return S
EndFunction

2
"Another Dimension" Game Project / Game explanation
« on: May 05, 2018, 07:33:26 AM »
This is a two-dimensional platform game, inspired by old games like FlashBack, Another World, Prince of Persia, and so on; the frames of the protagonist's animated gifs will be obtained from the FlashBack game sprites, which can be downloaded at the link below, so far only the gifs to walk and turn the protagonist were created:

http://www.logicbasic.net/images/FlashBack.png

This image, as well as background images, animated gifs and game sounds,  have been collected on the internet and may contain copyright, although these items have undergone modifications to adapt to the game.

The animated gifs of the protagonist were created with the software "Jasc Animation Shop" that can be downloaded at the link below:

http://www.softpedia.com/get/Multimedia/Graphic/Graphic-Editors/Animation-Shop.shtml

The animated gif of Jaguar was created based on the YouTube video that can be seen in the link below:

https://www.youtube.com/watch?v=a6yp7oldxVM

The video was downloaded on the site "SaveFromNet", then converted to animated gif on the site "Convertio", then link to those sites:

https://en.savefrom.net
https://convertio.co

With the "Animation Shop" software I reduced the animated gif and set a transparent background for all frames.

3
"Another Dimension" Game Project / Introduction
« on: May 05, 2018, 07:02:23 AM »
I launched this project for the development of an adventure game called "Another Dimension", where anyone from the Logic Basic community can participate.

The link to download the project is as follows:

http://www.logicbasic.net/download/AnotherDimension.zip

So far only the introduction of the game has been made, suggestions, bug reports, collaborations (animated gifs, backgrounds, sounds, game plot) will be well received, and anyone can make changes to the game and post in this section.

4
Apps for study and entertainment / Archimedes spiral
« on: March 12, 2018, 06:29:15 AM »
The archimedes spiral is applied in the construction of various mechanisms, such as scroll compressors, fans, centrifugal pumps, and so on. This is a rather simple and interesting example of fractal.

Code: [Select]
Var T Decimal, A Decimal, R Decimal, Xs Decimal, Ys Decimal
Var X0 Decimal, Y0 Decimal, X1 Decimal, Y1 Decimal

Window Res = 150, 250

T = 0.7 'starting point of spiral
A = 0.03 'increment size - spiral trail width
Xs = 125; Ys = 75
X0 = 0; Y0 = 0 'start point of line

While 1 = 1
  R = A * T
 
  X1 = R * Cos(T) * 50
  Y1 = R * Sin(T) * 50
  Straight Ys + Y0, Xs + X0, Ys + Y1, Xs + X1, Black
  X0 = X1; Y0 = Y1
  T = T + A
  Wait Events
Loop

5
News and announcements / In progress the ebook "Logic Basic - The Bible"
« on: December 15, 2017, 04:31:10 AM »
Soon the ebook titled "Logic Basic - The Bible" will be completed, explaining in detail all aspects of the language, teaching the development of practical applications, and including complete documentation of all commands and functions.

6
Apps for study and entertainment / Moves a point linearly in any direction
« on: November 27, 2017, 06:34:30 AM »
Function to move a point from an initial line, initial column to an end line, final column, great for creating games to fire in any direction, the function was based on the line generation algorithm at https://www.tutorialspoint.com/computer_graphics/line_generation_algorithm.htm:

Code: [Select]
Window PointSize = 10

Shoot(5, 5, 20, 70) 'Shoot from initial Line, initial Column to final line, final column

EndProgram

Function Shoot(L1 Integer, C1 Integer, L2 Integer, C2 Integer)
  Var DL Integer, DC Integer
  Var Steps Integer, LIncrement Decimal, CIncrement Decimal
  Var L Decimal, C Decimal, V Integer
 
  L = L1; C = C1

  If L2 > L1
    DL = L2 - L1
  Else
    DL = L1 - L2
  EndIf 
  If C2 > C1
    DC = C2 - C1
  Else
    DC = C1 - C2
  EndIf 

  If DL > DC
    Steps = DL
  Else
    Steps = DC
  EndIf 

  LIncrement = DL / Steps
  CIncrement = DC / Steps

  If L1 > L2; Lincrement = Lincrement * (-1); EndIf
  If C1 > C2; Cincrement = Cincrement * (-1); EndIf

  V = 0
  While V < Steps
    Cls
    L += LIncrement
    C += CIncrement
 
    Point L, C, Blue
    Wait Events
    V++
  Loop
EndFunction

7
Discussions about Logic Basic / 3D cube rotation
« on: October 26, 2017, 07:43:46 AM »
Below is a sample code for rotating a 3D cube, works from version 1.0.44:

Code: [Select]
Var Ixy_angle Decimal, Iz_angle Decimal, dYYshift Decimal, dXXshift Decimal, csx Decimal, csy Decimal
Var cosa Decimal, cosb Decimal, sina Decimal, sinb Decimal, xxx Decimal, yyy Decimal, x Decimal, y Decimal
Var coscosba Decimal, cossinba Decimal, sincosba Decimal, sinsinba Decimal, Zoom Decimal, Pi180 Decimal
Var Ret1 Decimal, Ret2 Decimal
                                                                                                       
Window Res=500,700

Button BtnLeft, Type1, 400, 120, "Left", "", ""
Button BtnRight, Type1, 400, 240, "Right", "", ""
Button BtnUp, Type1, 400, 360, "Up", "", ""
Button BtnDown, Type1, 400, 480, "Down", "", ""

Pi180 = 0.01745392
Ixy_angle = 270
Iz_angle = 85
Ret1 = Ixy_angle * Pi180   
Ret2 = Iz_angle * Pi180
cosa = Cos(Ret1); sina = Sin(Ret1); cosb = Cos(Ret2); sinb = Sin(Ret2)
sinsinba = sinb * sina; sincosba = sinb * cosa; cossinba = sina * cosb; coscosba = cosb * cosa
dYYshift = 80
dXXshift = 80
Zoom = 7

NewPaint()


While 1 = 1
  Wait ClickButton
  If RetStr = "BtnLeft"; RollLeft(); EndIf
  If RetStr = "BtnRight"; RollRight(); EndIf
  If RetStr = "BtnUp"; RollUp(); EndIf
  If RetStr = "BtnDown"; RollDown(); EndIf
  sinsinba = sinb * sina
  sincosba = sinb * cosa
  cossinba = sina * cosb
  coscosba = cosb * cosa
  Cls
  NewPaint()
Loop

EndProgram

Sub NewPaint()
  posxy(-1, -1, -1); xxx = csx; yyy = csy
  posxy(-1, 1, -1); Straight yyy, xxx, csy, csx, Red; x = csx; y = csy
  posxy(-1, 1, 1); Straight y, x, csy, csx, Red; x = csx; y = csy
  posxy(-1, -1, 1); Straight y, x, csy, csx, Red; Straight csy, csx, yyy, xxx, Red
  posxy(1, -1, -1); xxx = csx; yyy = csy
  posxy(1, 1, -1); Straight yyy, xxx, csy, csx, Red; x = csx; y = csy
  posxy(1, 1, 1); Straight y, x, csy, csx, Red; x = csx; y = csy
  posxy(1, -1, 1); Straight y, x, csy, csx, Red; Straight csy, csx, yyy, xxx, Red
  posxy(1, -1, -1); x = csx; y = csy; posxy(-1, -1, -1); Straight y, x, csy, csx, Red
  posxy(1, -1, 1); x = csx; y = csy; posxy(-1, -1, 1); Straight y, x, csy, csx, Red
  posxy(1, 1, 1); x = csx; y = csy; posxy(-1, 1, 1); Straight y, x, csy, csx, Red
  posxy(1, 1, -1); x = csx; y = csy; posxy(-1, 1, -1); Straight y, x, csy, csx, Red
EndSub
   
Function posxy(x1 Decimal, y1 Decimal, z1 Decimal) Decimal
  Var Yy Decimal, Xx Decimal

  Yy = Zoom / (10 - (z1 * cosb + y1 * sinsinba - x1 * sincosba))
  Xx = 100 * (1 + (y1 * cosa + x1 * sina) * Yy)
  csx = dXXshift + Xx
  Xx = 100 * (1 + (y1 * cossinba - x1 * coscosba - z1 * sinb) * Yy)
  csy = dYYshift + Xx
  csy = Round(csy, 0); csx = Round(csx, 0)

EndFunction

Sub RollLeft()
  Ixy_angle = Ixy_angle + 5
  Ret1 = Ixy_angle * Pi180
  cosa = Cos(Ret1)
  sina = Sin(Ret1)
EndSub

Sub RollRight()
  Ixy_angle = Ixy_angle - 5
  Ret1 = Ixy_angle * Pi180
  cosa = Cos(Ret1)
  sina = Sin(Ret1)
EndSub

Sub RollUp()
  Iz_angle = Iz_angle + 5
  Ret2 = Iz_angle * pi180
  cosb = Cos(Ret2)
  sinb = Sin(Ret2)
EndSub

Sub RollDown()
  Iz_angle = Iz_angle - 5
  Ret2 = Iz_angle * pi180
  cosb = Cos(Ret2)
  sinb = Sin(Ret2)
EndSub
   

8
News and announcements / Created the global variable CalcPrecision
« on: October 26, 2017, 07:31:28 AM »
Starting with version 1.0.44, the decimal results of mathematical expressions will have a maximum of 4 decimal places by default. To increase the accuracy of the calculation results as in previous versions, the programmer should set the global variable CalcPrecision equal to True, for example:

Var X Decimal, Y Decimal, T Decimal

CalcPrecision = True

X = 10.27
Y = 3.15

T = X / Y
Write T

CalcPrecision = False

T = X / Y
Write T

9
Discussions about Logic Basic / Welcome to the Logic Basic forum!
« on: October 19, 2017, 08:01:06 AM »
Welcome to the new Logic Basic forum, which will give more attention to members, and greater control over spam.

Pages: [1]