Y

YouLibs

Remove Touch Overlay

Bow and Arrow in the Blender Game Engine

Duration: 28:49Views: 39.4KLikes: 274Date Created: Jul, 2014

Channel: CG Masters

Category: Education

Tags: blender gamevideo tutorialgame enginebgeblender (software)free tutorialfree blender tutorialchris plushcg mastersblender tutorialblender

Description: VERSION UPDATE: There's a bug in latest blender versions that makes the arrow fall straight down when you pull the string all the way back. The problem was that when the pull animation reaches the last frame, it says it's on frame 0 for some reason, so 0 velocity is applied to the arrow. To work around this I've added 4 lines after the "else" statement that sets the frame number to 40 if it returns as 0, and I changed the launcher.actuators line to use the variable "frame" defined by those 4 new lines. You can see it in the updated script below. Couldn't figure out code formatting on youtube, so just replace [tab] tags with actually tabbing in there once or twice. import bge cont = bge.logic.getCurrentController() own = cont.owner pull = cont.actuators["pull"] fire = cont.actuators["fire"] space = cont.sensors["space"] launcher = bge.logic.getSceneList()[0].objects["arrow_launcher"] if space.positive: [tab]pull.frameStart = 1 [tab]pull.frameEnd = 40 [tab]cont.activate(pull) else: [tab]if pull.frame == 0: [tab][tab]frame = 40 [tab]else: [tab][tab]frame = pull.frame [tab]launcher.actuators["add_arrow"].linearVelocity = [-(frame * 15), 0, 0] [tab]pull.frameStart = 41 [tab]pull.frameEnd = 46 [tab]cont.activate(pull) [tab]cont.activate(fire) This is the second part of the bow and arrow tutorial series. Check out the first part(rigging a bow) at youtube.com/watch?v=jpsd0Aw1qvA Download the start file for this tutorial here: cgmasters.com/tutorials/bow_game_start.zip Download the final game here(textures won't display in 2.75, but game logic works): cgmasters.com/tutorials/bow_game_final.zip

Swipe Gestures On Overlay