Example
#{example}"); ipb.editor_values.get('templates')['togglesource'] = new Template(""); ipb.editor_values.get('templates')['toolbar'] = new Template(""); ipb.editor_values.get('templates')['button'] = new Template("
Emoticons
"); // Add smilies into the mix ipb.editor_values.set( 'show_emoticon_link', false ); ipb.editor_values.set( 'bbcodes', $H({"snapback":{"id":"1","title":"Post Snap Back","desc":"This tag displays a little linked image which links back to a post - used when quoting posts from the board. Opens in same window by default.","tag":"snapback","useoption":"0","example":"[snapback]100[/snapback]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"topic":{"id":"5","title":"Topic Link","desc":"This tag provides an easy way to link to a topic","tag":"topic","useoption":"1","example":"[topic=1]Click me![/topic]","switch_option":"0","menu_option_text":"Enter the topic ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"post":{"id":"6","title":"Post Link","desc":"This tag provides an easy way to link to a post.","tag":"post","useoption":"1","example":"[post=1]Click me![/post]","switch_option":"0","menu_option_text":"Enter the Post ID","menu_content_text":"Enter the title for this link","single_tag":"0","optional_option":"0","image":""},"spoiler":{"id":"7","title":"Spoiler","desc":"Spoiler tag","tag":"spoiler","useoption":"0","example":"[spoiler]Some hidden text[/spoiler]","switch_option":"0","menu_option_text":"","menu_content_text":"Enter the text to be masked","single_tag":"0","optional_option":"0","image":""},"acronym":{"id":"8","title":"Acronym","desc":"Allows you to make an acronym that will display a description when moused over","tag":"acronym","useoption":"1","example":"[acronym='Laugh Out Loud']lol[/acronym]","switch_option":"0","menu_option_text":"Enter the description for this acronym (EG: Laugh Out Loud)","menu_content_text":"Enter the acronym (EG: lol)","single_tag":"0","optional_option":"0","image":""},"hr":{"id":"12","title":"Horizontal Rule","desc":"Adds a horizontal rule to separate text","tag":"hr","useoption":"0","example":"[hr]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"1","optional_option":"0","image":""},"php":{"id":"14","title":"PHP Code","desc":"Allows you to enter PHP code into a formatted/highlighted syntax box","tag":"php","useoption":"0","example":"[php]$variable = true;\n\nprint_r($variable);[/php]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"html":{"id":"15","title":"HTML Code","desc":"Allows you to enter formatted/syntax-highlighted HTML code","tag":"html","useoption":"0","example":"[html]\n \n[/html]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"sql":{"id":"16","title":"SQL Code","desc":"Allows you to enter formatted/syntax-highlighted SQL code","tag":"sql","useoption":"0","example":"[sql]SELECT p.*, t.* FROM posts p LEFT JOIN topics t ON t.tid=p.topic_id WHERE t.tid=7[/sql]","switch_option":"0","menu_option_text":"","menu_content_text":"","single_tag":"0","optional_option":"0","image":""},"xml":{"id":"17","title":"XML Code","desc":"Allows you to enter formatted/syntax-highlighted XML code","tag":"xml","useoption":"0","example":"[xml]8 Replies - 75 Views - Last Post: Today, 09:11 AM
#1
Reputation: 1
- Posts: 92
- Joined: 07-October 12
Posted Today, 07:15 AM
I need a way for the bullet to have the coordinates of its target, so i thought i could use a pointer. But it isnt exactly working out.Here is the code i attempted:
//class Bullet_TrackingMissile Bullet_TrackingMissile (sf::Texture& spriteSheet, Enemy& target, int x, int y,int range) { this->target = target; //other code cut because it is irrelevant } void Update() { //check if target is null(if null that means it has died) target->//no members available float deltaX = target->GetX() - xPos; float deltaY = target->GetY() - yPos; float angle = std::atan(deltaY/deltaX)/DEGTORAD; if( deltaX < 0 ){ angle += 180;} if( deltaX >= 0 && deltaY < 0 ){ angle+= 360;} }
pls respond
Is This A Good Question/Topic? 0
Replies To: Confused about pointers, trying to make homing missile
#2
Reputation: 2946
- Posts: 8,952
- Joined: 25-December 09
Re: Confused about pointers, trying to make homing missile
Posted Today, 07:19 AM
Quote
But it isnt exactly working out.
So would you mind telling exactly why it's not "working out"?
You need to ask specific questions based on the code you provided.
Jim
#3
Reputation: 1
- Posts: 92
- Joined: 07-October 12
Re: Confused about pointers, trying to make homing missile
Posted Today, 07:37 AM
Oops sorry. The problem was that target has no available members in line 12
#4
Reputation: 2946
- Posts: 8,952
- Joined: 25-December 09
Re: Confused about pointers, trying to make homing missile
Posted Today, 07:41 AM
So how can we help? You haven't told us anything about this "target" or really any relevant data. In your snippets "target" seems to be uninitialized but I really can't tell with the paltry amount of code you've shown.You need to post the smallest complete program that illustrates your problem.
Jim
#5
Reputation: 1
- Posts: 92
- Joined: 07-October 12
Re: Confused about pointers, trying to make homing missile
Posted Today, 07:53 AM
#pragma once #include "Bullet.h" class Bullet_TrackingMissile : public Bullet { private: Enemy* target; public: Bullet_TrackingMissile (sf::Texture& spriteSheet, Enemy* target, int x, int y,int range) { this->target = target; s_Sprite.setTexture(spriteSheet); xPos = x; yPos = y; speed = 4; this->range = range/speed; rangeCnt = 0; damage = 10; s_Sprite.setTextureRect(sf::IntRect(22, 8, 5, 5)); s_Sprite.setOrigin(2,2); } void Update() { target->//no members } };
#6
Reputation: 2946
- Posts: 8,952
- Joined: 25-December 09
Re: Confused about pointers, trying to make homing missile
Posted Today, 08:01 AM
So like I said it looks, from the paltry code you provided, that target is not initialized. What is an Enemy? Where and how are you initializing this pointer? Either show all the relevant code or I can't help you.Jim
This post has been edited by jimblumberg: Today, 08:02 AM
#7
Reputation: 1
- Posts: 92
- Joined: 07-October 12
Re: Confused about pointers, trying to make homing missile
Posted Today, 08:03 AM
okay i changed it to this:Bullet_TrackingMissile (sf::Texture& spriteSheet, Enemy* target, int x, int y,int range) { this->target = new Enemy(); this->target = target;
but this->target still doesnt have any available members.
edit: should have been this->target = new Enemy();
This post has been edited by Nano511: Today, 08:15 AM
#8
Reputation: 2946
- Posts: 8,952
- Joined: 25-December 09
Re: Confused about pointers, trying to make homing missile
Posted Today, 08:29 AM
Since you won't provide the necessary information I can be of no further help. Good luck with your project.By the way your last snippet probably generates a memory leak when you reassign the pointer you allocated with new to point to something else.
Jim
#9
Reputation: 1
- Posts: 92
- Joined: 07-October 12
Re: Confused about pointers, trying to make homing missile
Posted Today, 09:11 AM
My problem was that Enemy wasnt included. Thanks for the help though
Page 1 of 1
jenny mccarthy auld lang syne dick clark Happy new year fiscal cliff Pitbull Hannah Storm
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.