Page 13 of 58 FirstFirst ... 3111213141523 ... LastLast
Results 121 to 130 of 576

Thread: DizzyAGE General Coding Queries

  1. #121
    Hard Boiled Egg delta's Avatar
    Join Date
    Feb 2007
    Location
    North West
    Posts
    4,005

    Default

    Quote Originally Posted by Lord Dizzy of Yolkfolk View Post
    How do you code to perform an action when Dizzy collides with something when hes walking, ie to make a brush move, also to make a prompt when he enters a room but that it only prompts the once.
    sorry, i would usually have replied to this sooner, but my coding head has been on the shelf for a while!

    anyway, this is either rather easy, or quite complicated, depending how you look at it.

    Basically you set a hidden object as a collider (object property COLLIDER=1), that when collided with (use function Collide_Object_ID_1() ) changes the COLLIDER property to 0 (NONE), and changes the status of the object you want to move (you can't move Static Brushes). Then in the Update_Room_RX_RY() function for that room, you have it checking the status of the object, and if it changes (for example to 1, when the player collides with the collider), then you move it using the same Update_Room_RX_RY() function. also check each time it's moved to see if it's got to where you want it to go. if it has, then change the status of it back to 0, so that it doesn't move anymore.

    If this is a bit confusing, or you're still not quite sure, let me know and i'll provide some example code for you.
    Last edited by delta; 18-06-09 at 08:17 PM.





    "Quotes from the internet may not be genuine" - Abraham Lincoln

  2. #122
    Hard Boiled Egg Lord Dizzy of Yolkfolk's Avatar
    Join Date
    Apr 2007
    Location
    Yorkshire
    Posts
    1,200

    Default

    Thanks guys with responding, appreciated, ive never heard of Photobucket, do I really need to upload the images somewhere first then to reference to. Is this because of memory.

    Why cant you simply just insert like you would normally by clicking a picture icon, finding where its saved and then insert like you would in excel or word for example. Be much simpler.

  3. #123
    Hard Boiled Egg Lord Dizzy of Yolkfolk's Avatar
    Join Date
    Apr 2007
    Location
    Yorkshire
    Posts
    1,200

    Default

    Quote Originally Posted by delta View Post
    sorry, i would usually have replied to this sooner, but my coding head has been on the shelf for a while!

    anyway, this is either rather easy, or quite complicated, depending how you look at it.

    Basically you set a hidden object as a collider (object property COLLIDER=1), that when collided with (use function Collide_Object_ID_1() ) changes the COLLIDER property to 0 (NONE), and changes the status of the object you want to move (you can't move Static Brushes). Then in the Update_Room_RX_RY() function for that room, you have it checking the status of the object, and if it changes (for example to 1, when the player collides with the collider), then you move it using the same Update_Room_RX_RY() function. also check each time it's moved to see if it's got to where you want it to go. if it has, then change the status of it back to 0, so that it doesn't move anymore.

    If this is a bit confusing, or you're still not quite sure, let me know and i'll provide some example code for you.

    Thats ok, yours always really helpful and I wouldnt have been able to attempt to make one without the tutorials and bits of help. I believe I should beable to do to completion now as ive coded most of it & done most of the map. An example code I be honest is nearly always the best for me if you can so kindly to go with the explanation.

    Thanks

  4. #124
    Hard Boiled Egg delta's Avatar
    Join Date
    Feb 2007
    Location
    North West
    Posts
    4,005

    Default

    hehe the problem is that the internet isn't like Word or Excel! think of it like this. when you close Word or Excel, what you've done is lost, except if you save it. it's the same concept for the web. if you don't 'save' the picture somewhere, no-one else will be able to see it!

    The real problem is that pictures are basically files. and files take up space on a web server. and space costs money. The webpages are files too, but they are text files, so take up a lot less space. Check on your computer the difference in file size between a text file and a picture file.

    so most websites won't allow users to upload pictures (or will limit the amount), because they would take up too much file space. So specialist sites have arisen (like photobucket) that let you store photos there, which you can then link to.





    "Quotes from the internet may not be genuine" - Abraham Lincoln

  5. #125
    Hard Boiled Egg Lord Dizzy of Yolkfolk's Avatar
    Join Date
    Apr 2007
    Location
    Yorkshire
    Posts
    1,200

    Default

    Cheers yes, knew had to be summat to that effect with memory

  6. #126
    Hard Boiled Egg delta's Avatar
    Join Date
    Feb 2007
    Location
    North West
    Posts
    4,005

    Default

    ok, the example code.

    we'll assume the following:

    the 'collider' object is ID 2000
    the 'moving' object is ID 2001
    the room you'll be in is room 02_05 (Room 2 on the X axis and 5 on the Y axis)
    the moving object will be moving from left to right, stopping at X co-ordinates 440.

    First set a Dynamic Object in the map somewhere in room 02_05. set the Property ID to 2000, the DRAW property to 2 (mat) and the property COLLIDER to 1 (call handler). This is the collider. (i assume you want it hidden. set DRAW to 3 if you want it visible)

    Set another Dynamic Object in the same room (around about X position 260), with Property ID set to 2001, property DELAY set to 4 and ensure property STATUS is set to 0 (it should be that as default). This will be the moving object.

    the code:

    Code:
    func CollideObject_2000_1()
    {
    	idx=ObjFind(2000);
    	ObjSet(idx,O_COLLIDER,0);			// stops player colliding with the collider again
    
    	idx=ObjFind(2001);
    	ObjSet(idx,O_STATUS,1);				// changes the status of the object to be moved
    }
    
    
    
    func UpdateRoom_2_5()
    {
    	idx=ObjFind(2001);
    	if(!IsUpdate(ObjGet(idx,O_DELAY))) return;	// sets a delay between frame updates using object property DELAY. The object will move way too fast without this line (try it!), and the speed can be changed by changing the value of object property DELAY in the map.
    
    	if(ObjGet(idx,O_STATUS)==1)			// check the status of the item to be moved.
    	{
    		x = ObjGet(idx,O_X);			// find X position of object to be moved and store in variable 'x'
    		x += 4;					// add 4 to variable 'x'
    
    		if(x>=440)				// check if variable 'x' is larger than we want it to go 
    		{
    			x=440;				// if it happens to be larger than 440, set it to 440
    			ObjSet(idx,O_STATUS,0);		// changes status of object to be moved back to 0, as we don't want it moving any further.
    		}
    		ObjSet(idx,O_X,x);			// change the X position of the moving object to whatever the value of variable 'x' is
    		ObjPresent(idx);			// force the object to be present in the current room (a bit of 'failsafe' code)
    	}
    }
    that should pretty much do it.

    you should be able to see from the UpdateRoom function that if the STATUS of the moving object is 1, then it will be moved right by 4 pixels every frame update. every time this happens, the code checks whether it is on or past 440 yet, and if it is, changes the STATUS to 0, so that the 'IF' statement checking the status becomes false and therefore stops moving the object.
    Last edited by delta; 18-06-09 at 09:34 PM.





    "Quotes from the internet may not be genuine" - Abraham Lincoln

  7. #127
    Hard Boiled Egg Lord Dizzy of Yolkfolk's Avatar
    Join Date
    Apr 2007
    Location
    Yorkshire
    Posts
    1,200

    Default

    Thanks, I will see to put into practice when I get some time in due course.

    Put into practice and working, just I changed to use Y coordinates instead.
    Last edited by Lord Dizzy of Yolkfolk; 20-06-09 at 04:06 PM. Reason: Actioned

  8. #128
    Hard Boiled Egg delta's Avatar
    Join Date
    Feb 2007
    Location
    North West
    Posts
    4,005

    Default

    Alex,

    is there an easy way to play game music without looping it?

    i've figured out a way, but it's not an easy way - basically i'd pre-load the length of the music as a variable, and use the game timer to count the seconds, and when it's counted up to the number of seconds in the tune, it would stop the music.

    i just wondered if there was an easier way?





    "Quotes from the internet may not be genuine" - Abraham Lincoln

  9. #129
    Hard Boiled Egg macon's Avatar
    Join Date
    Apr 2007
    Location
    Grimsby, England
    Posts
    174

    Default

    I think you need

    HandlerMusicLoop() in handlers.gs

  10. #130
    Hard Boiled Egg delta's Avatar
    Join Date
    Feb 2007
    Location
    North West
    Posts
    4,005

    Default

    ah yes, thank you!

    t'will be most useful for the game i'm planning for next years comp!





    "Quotes from the internet may not be genuine" - Abraham Lincoln

Similar Threads

  1. DizzyAGE News
    By xelanoimis in forum DizzyAGE Help
    Replies: 160
    Last Post: 27-04-10, 09:24 PM
  2. DizzyAGE Easter Competition 2009 [ENDED]
    By xelanoimis in forum Fan Games
    Replies: 153
    Last Post: 27-09-09, 11:20 AM
  3. DizzyAGE Easter Competition 2008 [ENDED]
    By xelanoimis in forum Fan Games
    Replies: 185
    Last Post: 23-08-08, 02:01 PM
  4. DizzyAGE games distribution format
    By xelanoimis in forum DizzyAGE Help
    Replies: 18
    Last Post: 30-07-08, 08:47 PM
  5. Alex and DizzyAGE here!
    By xelanoimis in forum Introductions
    Replies: 4
    Last Post: 30-01-07, 05:59 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •