Posts Tagged ‘Code’

Posts that have some sort of code.

Android: Loading and playing videos from different sources

Click here to read Android: Loading and playing videos from different sources

This is the 41st post on the website! It explains how to load images from a variety of locations, such as the ‘Resources’ folder, the SD card and from a remote server. As usual, the source code is available for download at the end of the post.

Let’s start with the basics: video formats. At the time this is being written, Android supports .3gp and .mp4 video files encoded as H.263,H.264 and MPEG-4 SP file formats. For an updated list, visit this link.

(more…)

Unity3D: Programming a machine gun – Part 2

Click here to read Unity3D: Programming a machine gun – Part 2

This is the second and last post of this series that explains how to code a machine gun in Unity3D. The first post explained how to make the automatic firing mechanism, and this one will focus on how to set-up the machine gun, the bullet and explain the code that makes it all work. Also, a Unity3D project with all the source code discussed on the series is available for download at the end of the post.

So, let’s start by setting the machine gun. The 3D model of the gun can be any one, you don’t even have to create a 3D model at all, it is possible to use Unity3D’s cubes and other primitives. The only thing that one must know is that the muzzle of the gun must be a completely separate element. This is crucial when making the gun at an external 3D modeling application such as 3D Studio Max, Blender or XSI. (more…)

Unity3D: Programming a machine gun – Part 1

Click here to read Unity3D: Programming a machine gun – Part 1

This is the first of two posts that will explain how to program a machine gun at the Unity3D game engine. This post will focus on coding the element that defines a weapon of this type: continuous automatic firing. It will show two different ways to achieve this behavior: one based on the Invoke() method call, and the other based on Unity3D’s coroutines. As any other post series in this website, a Unity3D project with all the source code will be available at the last post of the series.

All code in this post will be in C#, but for those who don’t use it, a JavaScript version of the code will be available for download at the end of the post.

(more…)

Android: Creating a button to load images from a remote server

Click here to read Android: Creating a button to load images from a remote server

This is a follow up to the post published two days ago that explained how to load images into a View’s Canvas from different sources. Differently from the last post, I will explain how to load images from a remote server after the View has been loaded and rendered on the screen. Also, this post features how to download an image after pressing a button.

So, let’s get to it. The first thing the reader might be thinking is that we just need to create a button and place the code that downloads the image inside it. It’s not as simple as that, due to these problems: (more…)

Android: loading images from a remote sever, SD card and from the Resources folder

Click here to read Android: loading images from a remote sever, SD card and from the Resources folder

As stated on the title, this post will explain how to load a image from 3 different sources: the SD card, from a remote server and from the Resources folder. Since the methods and code used to load these images from these sources are different from one another, this post is going to be divided into three different parts, one for each location.

Select one of the following links to go to a specific part of the post: (more…)