User Tools

Site Tools


en:tutorials:orxscroll:binding-orxscroll

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
tutorials:community:acksys:scroll1 [2017/07/26 05:50 (7 years ago)] sausageen:tutorials:orxscroll:binding-orxscroll [2021/02/17 09:06 (3 years ago)] (current) iarwain
Line 12: Line 12:
  
 Additionally, binding objects to classes makes it easy to handle Orx events on an object-specific basis. For example, each type of object can have its own OnCreate function which is called whenever an object of that type is created. OnDelete is called when the object is deleted, etc. Additionally, binding objects to classes makes it easy to handle Orx events on an object-specific basis. For example, each type of object can have its own OnCreate function which is called whenever an object of that type is created. OnDelete is called when the object is deleted, etc.
 +
 +{{:tutorials:orxscroll:character_boy.png?nolink|}} {{:tutorials:orxscroll:enemy_bug.png?nolink|}}
  
 In this tutorial, we're going to create a small game with two specific examples of object binding. We'll create an Enemy Bug object and a Hero object and bind them to classes. Our enemy bugs will move semi-randomly across the screen. Our Hero will be controlled by the player. He'll flash red if he collides with an enemy bug, showing that he's hurt. In this tutorial, we're going to create a small game with two specific examples of object binding. We'll create an Enemy Bug object and a Hero object and bind them to classes. Our enemy bugs will move semi-randomly across the screen. Our Hero will be controlled by the player. He'll flash red if he collides with an enemy bug, showing that he's hurt.
Line 25: Line 27:
 ===== Create a new Scroll Project ===== ===== Create a new Scroll Project =====
  
-Before you begin this tutorial, you need a basic Orx/Scroll project ready. For details on doing this, see the previous tutorial, [[tutorials:community:acksys:scroll0|An Introduction to Scroll]].+Before you begin this tutorial, you need a basic Orx/Scroll project ready. For details on doing this, see the previous tutorial, [[en:tutorials:orxscroll:introduction-orxscroll|An Introduction to Scroll]].
  
 This tutorial assumes you've made a new Orx/Scroll project by following the instructions in the previously tutorial exactly! This tutorial assumes you've made a new Orx/Scroll project by following the instructions in the previously tutorial exactly!
Line 33: Line 35:
 You'll need to download these textures ((Thanks to Daniel Cook of www.lostgarden.com for the great prototyping graphics)) for use in your config: You'll need to download these textures ((Thanks to Daniel Cook of www.lostgarden.com for the great prototyping graphics)) for use in your config:
  
-{{http://acksys.orx-project.org/images/Character_Boy.png}} +{{tutorials:orxscroll:character_boy.png}} 
-{{http://acksys.orx-project.org/images/Enemy_Bug.png}}+{{tutorials:orxscroll:enemy_bug.png}}
  
 Then, you'll need to prepare this config in your main Orx .ini file for use with this tutorial: Then, you'll need to prepare this config in your main Orx .ini file for use with this tutorial:
Line 327: Line 329:
     virtual orxBOOL OnCollide (ScrollObject *_poCollider,     virtual orxBOOL OnCollide (ScrollObject *_poCollider,
         const orxSTRING _zPartName,         const orxSTRING _zPartName,
 +        const orxSTRING _zColliderPartName,
         const orxVECTOR &_rvPosition,         const orxVECTOR &_rvPosition,
         const orxVECTOR &_rvNormal);         const orxVECTOR &_rvNormal);
Line 379: Line 382:
 orxBOOL Hero::OnCollide(ScrollObject *_poCollider, orxBOOL Hero::OnCollide(ScrollObject *_poCollider,
        const orxSTRING _zPartName,        const orxSTRING _zPartName,
 +       const orxSTRING _zColliderPartName,
        const orxVECTOR &_rvPosition,        const orxVECTOR &_rvPosition,
        const orxVECTOR &_rvNormal)        const orxVECTOR &_rvNormal)
Line 422: Line 426:
 When you run the game, you'll be able to control the hero with the arrow keys. Be careful, the bugs will bite him if he gets too close and the OnCollision callback will make him "flash" red. When you run the game, you'll be able to control the hero with the arrow keys. Be careful, the bugs will bite him if he gets too close and the OnCollision callback will make him "flash" red.
  
-{{http://i.imgur.com/YmnW1.png?500}}+{{ :tutorials:orxscroll:binding-orxscroll-screenshot.png?nolink&500 |}}
  
 ===== What Now? ===== ===== What Now? =====
en/tutorials/orxscroll/binding-orxscroll.1501073452.txt.gz · Last modified: 2017/07/26 08:50 (7 years ago) (external edit)