Ooops
November 27, 2020, 05:59:39 PM

Author Topic: [bb] Terrainedit by fireshadow4126 [ 1+ years ago ]  (Read 1082 times)

Offline BlitzBot

  • Jr. Member
  • **
  • Posts: 1
[bb] Terrainedit by fireshadow4126 [ 1+ years ago ]
« on: June 29, 2017, 12:28:42 AM »
Title : Terrainedit
Author : fireshadow4126
Posted : 1+ years ago

Description : example: u could use this with a for...next statement and width and depth 0 to create a forest of spikes
height has to be 0-1
to make the height seem greater, scale the y axis of the terrain


Code :
Code: BlitzBasic
  1. Function terrainedit(terrain,x,z,width,depth,height)
  2.  
  3.         end_x = x + width
  4.         end_z = z + depth
  5.        
  6.         For a = x To end_x
  7.         For b = z To end_z
  8.                 ModifyTerrain terrain,a,b,height
  9.         Next
  10.         Next
  11.        
  12. End Function


Comments :


Matty(Posted 1+ years ago)

 You might want to do some bounds checking on those for loops, in particular the end_x and end_z variables.


DreamLoader(Posted 1+ years ago)

 how to do a circle raise?


fireshadow4126(Posted 1+ years ago)

 circle:
Code: [Select]
terrain = CreateTerrain(1024)
PositionEntity terrain,-256,-1,-256
ScaleEntity terrain,1,5,1
texture = LoadTexture("rocktexture1.bmp")
EntityTexture terrain,texture
For theta = 0 To 360
x = (Cos(theta) * 5)+100
z = (Sin(theta) * 5)+100
Terrain_Edit(terrain,x,z,1,1,1)
Next
The 100s are to make the circle not on the very edge of the terrain.To increase the radius of the circle, replace the 5swith whatever you want


_Skully(Posted 1+ years ago)

 A better way to do circles inside a grid is to use distance... for example, in a rectangle
Code: [Select]
cx=50
cy=50
radius=30
for x=0 to 100
  for y=0 to 100
     if sqr((cx-x)^2+(cy-y)^2)<=radius then
        ;Inside circle
     else
        ; outside circle
     Endif
  next
next




 

SimplePortal 2.3.6 © 2008-2014, SimplePortal