-->

CARI

Last Tweet

Bikin Game dengan Blender dari Awal sampai Akhir

Bikin Game dengan Blender dari Awal sampai Akhir
Bikin Game dengan Blender dari Awal sampai Akhir
Ane nemukan tutorial bagus yang suka bikin game atau bagi yang mau belajar membuat game dengan Blender 3d. Tutorial ini ane terjemahkan dari forum blenderartist.org. Ni silakan disimak terjemah dari treatnya.

Dari awal sampai akhir, membuat Blender Game (PDF)


Dalam serangkaian Tutorial PDF saya akan menunjukkan Anda, dari awal sampai akhir cara membuat permainan yang cukup kompleks di Blender mesin permainan. Anda akan perlu memiliki beberapa keterampilan Blender seperti dasar pemodelan, tapi aku memberikan banyak info tentang setiap aspek lain dari membuat permainan.

Pada awalnya Anda akan menjadi "plugging di" pra-menulis skrip untuk mendapatkan benda Anda untuk melakukan dengan benar, tetapi kemudian saya akan menunjukkan bagaimana menulis Anda sendiri scritps Python untuk BGE.

Aku akan mencakup banyak aspek, termasuk dasar Ai permainan tujuan, beberapa misi, switching jerat dan menggunakan Kamus untuk menyimpan informasi. Anda akan belajar bagaimana untuk menyimpan dan memuat game, serta bagaimana menambahkan sebuah HUD dan peta mini permainan Anda.

Tutorialnya adalah sebagai berikut:
1. membuat model permainan menggunakan proyeksi tekstur kue.
2. dasar pemain gerakan untuk helikopter.
3. manajemen, termasuk musuh kerusakan dan pemain amunisi senjata.

Download tutorial PDFnya di sini : Part 1 dan Part 2

 Python script. Salin dan sisipkan script berikut ini ke file campuran Anda dan nama itu dengan cobra.py:


####################################################
### imports

import bge

####################################################
### get window info

def window_info():
y= bge.render.getWindowHeight() *0.5
x= bge.render.getWindowWidth() *0.5

return (y,x)

####################################################
### stop roll and pitch exceeding maximum

def max_value(own):

max_setting = 80

if own['pitch'] > max_setting:
own['pitch'] = max_setting
if own['pitch'] < -max_setting:
own['pitch'] = -max_setting
if own['roll'] > max_setting:
own['roll'] = max_setting
if own['roll'] < -max_setting:
own['roll'] = -max_setting

####################################################
### apply movement and rotation

def movement(own,cont,cobra_motion,cobra_rotation):
move_sense = 0.2
rotation_sense = 0.00002

location = own['pitch'] * move_sense
roll = own['roll'] * -move_sense
rotation = own['yaw'] * rotation_sense

cobra_rotation.dRot = [0.0, 0.0 , rotation]
cont.activate(cobra_rotation)

cobra_motion.linV= [roll, location , 0.0]
cont.activate(cobra_motion)

####################################################
### main control script

def cobra_controls(cont):

################################################
### set own object, sensors and actuators

own = cont.owner

m_move = cont.sensors['m_move'] # mouse pointer movement
middle_m = cont.sensors['middle_m'] # middle button, used to toggle strafe

cobra_motion = cont.actuators['cobra_motion'] # moves the chopper
cobra_rotation = cont.actuators['cobra_rotation'] # rotates the chopper
tilting = cont.actuators['tilting'] # visual tilt of the chopper
rolling = cont.actuators['rolling'] # visual roll of the chopper

################################################
### get window info and mouse position
### return mouse pointer to the center

window = window_info() ### this calls up info from our first function
y = window[0]
x = window[1]
pos = m_move.position ### this is the position of the mouse
bge.render.setMousePosition(int(x),int(y)) ### we need to reset the mouse pointer now

################################################
### here we set some local properties
### you could set these on the object
### properties panel too for more control

min_sens = 2 # dead zone of mouse movement
p_adjust = y-pos[1] # how far the mouse pointer has shifted from 0 on the y axis
r_adjust = x-pos[0] # how far the mouse pointer has shifted from 0 on the y axis

### how quickly the mouse moves the player object

pitch_rate = 0.2
roll_rate = 0.2
yaw_rate = 1.2

### how quickly it returns to a neutral orientation

pitch_reset = 0.001
roll_reset = 0.02
yaw_reset = 0.02

### a misc value

twitch = 0.05

################################################
### here we use the mouse input to set properties
### which will drive motion and rotation
### as well as showing in game as aircraft
### tilt and roll

if middle_m.positive: # if we want to strafe from side to side and reset other movement
if abs(r_adjust) < min_sens: # if no x axis movement of mouse
own['roll'] -= own['roll'] * roll_reset # -= means reduce property by this much
else:
own['roll'] += r_adjust * roll_rate # += means increase by this amount

own['yaw'] -= own['yaw'] * twitch
own['pitch'] -= own['pitch'] * twitch

else: # normal movement profile
if abs(r_adjust) < min_sens: # if no x axis movement of mouse
own['yaw'] -= own['yaw'] * yaw_reset
own['roll'] -= own['roll'] * roll_reset
else:
own['yaw'] += r_adjust * yaw_rate
own['roll'] += r_adjust * twitch # if not strafing, we want to turn but also roll a little

if abs(p_adjust) < min_sens: # if the mouse is not moving on the y axis
own['pitch'] -= own['pitch'] * pitch_reset
else:
own['pitch'] += p_adjust *pitch_rate

################################################
### here we use a function to stop pitch and roll from exceeding maximum value

max_value(own)

################################################
### this is the function to apply movement

movement(own,cont,cobra_motion,cobra_rotation)

################################################
### these are functions to adjust the pitch and roll of the model using empties

tilter = tilting.owner
tilter['tilt'] = own['pitch']
cont.activate(tilting)

roller = rolling.owner
roller['roll'] = -own['roll']
cont.activate(rolling)

################################################
### This is a short script for making the camera follow the player


def cam_loc(cont):
own = cont.owner

if own['player_ob']:
### make the camera parent locked on to the player
own.worldPosition= own['player_ob'].worldPosition

Advertisement