设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 27506|回复: 57
打印 上一主题 下一主题

[转载] 我找到了RMXP真3D的(重要!)脚本达人分享(有视频真相!

[复制链接]

Lv1.梦旅人

梦石
0
星屑
50
在线时间
59 小时
注册时间
2012-3-10
帖子
36
跳转到指定楼层
1
发表于 2012-4-10 22:02:16 | 显示全部楼层 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 robot凯恩 于 2012-4-10 22:49 编辑

是在外国网站找到的

先放几个脚本

你们研究下


游戏范例我也有


我做个视频你们看看 绝对震撼

  1.   DF_GameWindow.set_dimensions(0,0,0,0)
  2.   device = DF3DDevice.new(Video::EDT_DIRECT3D9, [800,600], 32, false)
  3.   smgr = device.scene_manager
  4.   driver = device.video_driver
  5.   camera = smgr.add_camera_scene_node_FPS
  6.   camera.set_position(-100,300,-100)
  7.   camera.set_target(0,0,0)
  8.   $data_tilesets      = load_data("Data/Tilesets.rxdata")
  9.   $data_common_events = load_data("Data/CommonEvents.rxdata")
  10.   $game_map = Game_Map.new
  11.   $game_map.setup(1)
  12.   
  13.   for i in 0...20
  14.     for j in 0...15
  15.       for k in 0...3
  16.         if $game_map.data[i,j,k] != 0
  17.           node = smgr.add_cube_scene_node(64)
  18.           node.set_position(i * 64, k * 64, j * 64)
  19.           node.set_material_flag(Video::EMF_LIGHTING, false)
  20.           texture_name = ($game_map.data[i,j,k] - 383).to_s + ".png"
  21.           node.set_material_texture(0, driver.get_texture(texture_name))
  22.         end
  23.       end
  24.     end
  25.   end
  26.   
  27.         
  28.   
  29.   lasttime = Time.now
  30.   while device.run
  31.     DF_Input.update
  32.    
  33.     if DF_Input.trigger?(DF_Input::KEY_F)
  34.       p driver.get_fps
  35.     end
  36.    
  37.     time = Time.now
  38.     if time - lasttime > 5
  39.       Graphics.update
  40.       lasttime = Time.now
  41.     end
  42.     driver.begin_scene(true, true, [255, 160, 160, 255])
  43.     smgr.draw_all
  44.     driver.end_scene
  45.   end
  46.   
  47.   device.drop
复制代码
另外一段
  1. #First, let's move the 2D window out of the way:
  2.   DF_GameWindow.set_dimensions(0,0,0,0)
  3.   #next, let's create out device. The parameters are:
  4.   #Driver type, screen size (in an array), bits per pixel, and fullscreen
  5.   #This device is the central point of the 3D engine. Absolutely everything
  6.   #can be accessed through this device.
  7.   device = DF3DDevice.new(Video::EDT_DIRECT3D9, [800,600], 32, false)
  8.   #Now, let's get our scene manager. The scene manager does stuff like adding nodes
  9.   #and cameras
  10.   smgr = device.scene_manager
  11.   #Now, let's get our driver. The driver handles actually rendering.
  12.   driver = device.video_driver
  13.   #Let's get our mesh! (Note that you should probably add error handling here.
  14.   #smgr.get_mesh will return nil if it can't find the file so make sure you
  15.   #always check that the mesh was actually created. I didn't do any error handling
  16.   #but a simple check for nil would suffice)
  17.   mesh = smgr.get_mesh("sydney.md2")
  18.   #Let's create an animated scene node from the mesh. Again, normally you
  19.   #want to check for errors.
  20.   node = smgr.add_animated_mesh_scene_node(mesh)
  21.   #now, let's add a camera to the scene node! Camera are how you view everything
  22.   #in the scene. Note that it is possible to have more than one camera and
  23.   #you can switch between them, or even have them render to different parts
  24.   #of the screen.
  25.   camera = smgr.add_camera_scene_node
  26.   #move our camera, since both the camera and scene node are at the same, default
  27.   #position right now. (Which is (0,0,0)) Note that the parameters here are x, y, z.
  28.   #when your camera is at (0,0,0) and has no rotation, x is sideways, y is up,
  29.   #and z is forwards/backwards
  30.   camera.set_position(100,100,100)
  31.   #Rememeber how I said that the default position is 0,0,0? Well, since we never moved
  32.   #our node, it is at 0,0,0 right now. So, Let's tell the camera to look there:
  33.   camera.set_target(0,0,0)
  34.   
  35.   lasttime = Time.now
  36.   while device.run #check if our device is still running
  37.     #begin rendering the scene. I will not explain what these parameters are yet
  38.     #it's not important right now, and it's kind of complicated XD
  39.     driver.begin_scene(true, true, [255, 160, 160, 255])
  40.     smgr.draw_all #draw all of the scene nodes
  41.     driver.end_scene #finish rendering the scene
  42.     #this junk is just so Graphics doesn't whine.
  43.     time = Time.now
  44.     if time - lasttime > 5
  45.       Graphics.update
  46.     end
  47.   end
  48.   
  49.   #Now, alway always always remember to drop your device when you are done.
  50.   #The device is something you should only drop at the end of your game, after
  51.   #the device no longer runs.
  52.   device.drop
复制代码
这个是我刚用范例做的视频 忘记调清晰度了

有点不清楚

不过这绝对是真3D

鼠标控制视角

方向键行走

FPS在150-230之间

想走也很流畅的

点评

那个视频看得头晕晕的(3D眩晕症)  发表于 2012-4-15 21:01
转载内容请附上原发布地址。请尊重他人劳动成果。  发表于 2012-4-14 13:43
请注明源地址,谢谢支持。  发表于 2012-4-13 22:45
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-6 11:33

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表